Skip to content

Commit

Permalink
test: Fix deploy test
Browse files Browse the repository at this point in the history
  • Loading branch information
Natoandro committed Dec 4, 2023
1 parent ce8327b commit d4103b1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
5 changes: 4 additions & 1 deletion meta-cli/src/cli/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ impl Deploy<DefaultModeData> {
}

let node_config = config.node(&deploy.node, &deploy.target);
let node = node_config.build(&dir).await?;
let node = node_config
.build(&dir)
.await
.with_context(|| format!("building node from config: {node_config:#?}"))?;
let push_config = PushConfig::new(node, config.base_dir.clone());

Ok(Self {
Expand Down
10 changes: 7 additions & 3 deletions meta-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl NodeConfig {
Node::new(
self.url.clone(),
self.prefix.clone(),
Some(self.basic_auth(dir).await?),
Some(self.basic_auth(dir).await.context("basic auth")?),
self.env.clone(),
)
}
Expand Down Expand Up @@ -168,7 +168,9 @@ impl FromStr for Config {
type Err = serde_yaml::Error;

fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_yaml::from_str(s)
let mut config: serde_yaml::Value = serde_yaml::from_str(s)?;
config.apply_merge()?;
serde_yaml::from_value(config)
}
}

Expand All @@ -188,7 +190,9 @@ impl Config {
}
_ => anyhow!(err.to_string()),
})?;
let mut config: Self = serde_yaml::from_reader(file)?;
let mut config: serde_yaml::Value = serde_yaml::from_reader(file)?;
config.apply_merge()?;
let mut config: Self = serde_yaml::from_value(config)?;
config.path = Some(path.clone());
config.base_dir = {
let mut path = path;
Expand Down
7 changes: 6 additions & 1 deletion typegate/tests/e2e/cli/deploy_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const m = new TestModule(import.meta);

const tgName = "migration-failure-test";

/**
* These tests use different ports for the virtual typegate instance to avoid
* conflicts with one another when running in parallel.
*/

async function writeTypegraph(version: number | null) {
if (version == null) {
await m.shell([
Expand Down Expand Up @@ -163,7 +168,7 @@ Meta.test(

await deploy(port);
},
{ port: 7986, systemTypegraphs: true },
{ port: 7896, systemTypegraphs: true },
);

Meta.test("cli:deploy - automatic migrations", async (t) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ snapshot[`GraphQL parser 1`] = `
as_id: false,
config: {},
input: 3,
materializer: 0,
materializer: 1,
output: 5,
policies: [
0,
],
rate_calls: false,
rate_weight: null,
runtime: 1,
title: "func_6",
title: "func_7",
type: "function",
},
{
Expand Down Expand Up @@ -101,7 +101,7 @@ snapshot[`GraphQL parser 1`] = `
rate_calls: false,
rate_weight: null,
runtime: 1,
title: "func_8",
title: "func_9",
type: "function",
},
{
Expand Down Expand Up @@ -129,7 +129,7 @@ snapshot[`GraphQL parser 1`] = `
rate_calls: false,
rate_weight: null,
runtime: 1,
title: "func_11",
title: "func_12",
type: "function",
},
{
Expand Down Expand Up @@ -178,7 +178,7 @@ snapshot[`GraphQL parser 1`] = `
rate_calls: false,
rate_weight: null,
runtime: 1,
title: "func_13",
title: "func_14",
type: "function",
},
{
Expand Down

0 comments on commit d4103b1

Please sign in to comment.