Skip to content

Commit 0b59dac

Browse files
committed
Fix tests
1 parent 89dfb13 commit 0b59dac

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

plrust-tests/src/trusted.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,16 @@ mod tests {
190190

191191
#[pg_test]
192192
#[search_path(@extschema@)]
193-
#[should_panic = "environment variable `PATH` not defined at compile time."]
193+
#[should_panic = "environment variable `FOOBAR` not defined at compile time."]
194194
#[cfg(feature = "trusted")]
195195
fn plrust_block_env() -> spi::Result<()> {
196196
let definition = r#"
197-
CREATE FUNCTION get_path() RETURNS text AS $$
198-
let path = env!("PATH");
199-
Ok(Some(path.to_string()))
197+
CREATE FUNCTION get_foobar() RETURNS text AS $$
198+
let foo = env!("FOOBAR");
199+
Ok(Some(foo.to_string()))
200200
$$ LANGUAGE plrust;
201201
"#;
202+
std::env::set_var("FOOBAR", "1");
202203
Spi::run(definition)
203204
}
204205

@@ -208,12 +209,13 @@ mod tests {
208209
#[cfg(feature = "trusted")]
209210
fn plrust_block_option_env() -> spi::Result<()> {
210211
let definition = r#"
211-
CREATE FUNCTION try_get_path() RETURNS text AS $$
212-
let v = option_env!("PATH")
212+
CREATE FUNCTION try_get_foobar2() RETURNS text AS $$
213+
let v = option_env!("FOOBAR2")
213214
.expect("the `option_env` macro always returns `None` in the PL/Rust user function");
214215
Ok(Some(v.to_string()))
215216
$$ LANGUAGE plrust;
216217
"#;
218+
std::env::set_var("FOOBAR2", "1");
217219
Spi::run(definition)
218220
}
219221

0 commit comments

Comments
 (0)