Skip to content

Commit

Permalink
Enable the config-store-lookup tests (#387)
Browse files Browse the repository at this point in the history
The tests in cli/tests/integration/config_store_lookup.rs weren't being run because the module wasn't declared in cli/tests/integration/main.rs. I've re-enabled them, and copied the dictionary-lookup.rs test fixture to config-store-lookup.rs, to allow them to run successfully.
  • Loading branch information
elliottt authored Jun 18, 2024
1 parent d3870da commit b7b5504
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cli/tests/integration/config_store_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ async fn json_config_store_lookup_works() -> TestResult {
description = "json config_store lookup test"
authors = ["Jill Bryson <[email protected]>", "Rose McDowall <[email protected]>"]
language = "rust"
[local_server]
[local_server.config_stores]
[local_server.config_stores.animals]
file = "../test-fixtures/data/json-config_store.json"
format = "json"
"#;

let resp = Test::using_fixture("config_store-lookup.wasm")
// let resp = Test::using_fixture("config_store-lookup.wasm")
let resp = Test::using_fixture("config-store-lookup.wasm")
.using_fastly_toml(FASTLY_TOML)?
.against_empty()
.await?;
Expand All @@ -37,16 +36,14 @@ async fn inline_toml_config_store_lookup_works() -> TestResult {
description = "inline toml config_store lookup test"
authors = ["Jill Bryson <[email protected]>", "Rose McDowall <[email protected]>"]
language = "rust"
[local_server]
[local_server.config_stores]
[local_server.config_stores.animals]
format = "inline-toml"
[local_server.config_stores.animals.contents]
dog = "woof"
cat = "meow"
"#;

let resp = Test::using_fixture("config_store-lookup.wasm")
let resp = Test::using_fixture("config-store-lookup.wasm")
.using_fastly_toml(FASTLY_TOML)?
.against_empty()
.await?;
Expand All @@ -69,7 +66,7 @@ async fn missing_config_store_works() -> TestResult {
language = "rust"
"#;

let resp = Test::using_fixture("config_store-lookup.wasm")
let resp = Test::using_fixture("config-store-lookup.wasm")
.using_fastly_toml(FASTLY_TOML)?
.against_empty()
.await?;
Expand Down
1 change: 1 addition & 0 deletions cli/tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod async_io;
mod body;
mod client_certs;
mod common;
mod config_store_lookup;
mod device_detection_lookup;
mod dictionary_lookup;
mod downstream_req;
Expand Down
10 changes: 10 additions & 0 deletions test-fixtures/src/bin/config-store-lookup.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//! A guest program to test that dictionary lookups work properly.
use fastly::ConfigStore;

fn main() {
let animals = ConfigStore::open("animals");
assert_eq!(animals.get("dog").unwrap(), "woof");
assert_eq!(animals.get("cat").unwrap(), "meow");
assert_eq!(animals.get("lamp"), None);
}

0 comments on commit b7b5504

Please sign in to comment.