We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent3bb2680 commita868029Copy full SHA for a868029
pgml-extension/src/config.rs
@@ -2,6 +2,9 @@ use lazy_static::lazy_static;
2
use pgrx::{GucContext,GucFlags,GucRegistry,GucSetting};
3
use std::ffi::CStr;
4
5
+#[cfg(any(test, feature ="pg_test"))]
6
+use pgrx::{pg_schema, pg_test};
7
+
8
lazy_static!{
9
pubstatic refPGML_VENV:(&'staticstr,GucSetting<Option<&'staticCStr>>) =
10
("pgml.venv",GucSetting::<Option<&'staticCStr>>::new(None));
@@ -59,3 +62,17 @@ pub fn set_config(name: &str, value: &str) -> Result<(), pgrx::spi::Error> {
59
62
let query =format!("SELECT set_config('{name}', '{value}', false);");
60
63
pgrx::Spi::run(&query)
61
64
}
65
66
67
+#[pg_schema]
68
+mod tests{
69
+usesuper::*;
70
71
+#[pg_test]
72
+fnread_pgml_huggingface_whitelist(){
73
+let name ="pgml.huggingface_whitelist";
74
+let value ="meta-llama/Llama-2-7b";
75
+set_config(name, value).unwrap();
76
+assert_eq!(PGML_HF_WHITELIST.1.get().unwrap().to_string_lossy(), value);
77
+}
78