Skip to content

Commit

Permalink
Re-enable integration tests in CI (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton authored Nov 10, 2021
1 parent c2e92f1 commit d7bad91
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ jobs:
background: true
- run:
name: wait for federation demo to start
command: npx wait-on tcp:4001 tcp:4002 tcp:4003 tcp:4004 tcp:4000
command: npx wait-on tcp:4001 tcp:4002 tcp:4003 tcp:4004 tcp:4100

- run:
command: >
cargo xtask test
cargo xtask test --with-demo
- run:
command: >
cargo xtask lint
Expand Down
1 change: 1 addition & 0 deletions crates/apollo-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ warp = { version = "0.3.2", default-features = false, features = [
] }

[dev-dependencies]
apollo-router-core = { path = "../apollo-router-core", features = ["post-processing"] }
httpmock = "0.6.2"
insta = "1.8.0"
maplit = "1.0.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/apollo-router/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ async fn missing_variables() {

async fn query_node(request: graphql::Request) -> graphql::ResponseStream {
let nodejs_impl =
HttpSubgraphFetcher::new("federated".into(), "http://localhost:4000/graphql".into());
HttpSubgraphFetcher::new("federated".into(), "http://localhost:4100/graphql".into());
nodejs_impl.stream(request).await
}

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
services:
build: dockerfiles/federation-demo
ports:
- 4100:4100
- 4001:4001
- 4002:4002
- 4003:4003
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/federation-demo/federation-demo
Submodule federation-demo updated 1 files
+1 −1 gateway.js
20 changes: 16 additions & 4 deletions xtask/src/commands/test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{ensure, Result};
use structopt::StructOpt;
use xtask::*;

Expand All @@ -12,13 +12,22 @@ const FEATURE_SETS: &[&[&str]] = &[

#[derive(Debug, StructOpt)]
pub struct Test {
/// Do not start federation demo.
#[structopt(long)]
/// Do not start federation demo (deprecated, this is the default now).
#[structopt(long, conflicts_with = "with-demo")]
no_demo: bool,

/// Do start the federation demo (without docker).
#[structopt(long, conflicts_with = "no-demo")]
with_demo: bool,
}

impl Test {
pub fn run(&self) -> Result<()> {
ensure!(
!(self.no_demo && self.with_demo),
"--no-demo and --with-demo are mutually exclusive",
);

// NOTE: it worked nicely on GitHub Actions but it hangs on CircleCI on Windows
let _guard: Box<dyn std::any::Any> = if !std::env::var("CIRCLECI")
.ok()
Expand All @@ -29,7 +38,10 @@ impl Test {
eprintln!("Not running federation-demo because it makes the step hang on Circle CI.");
Box::new(())
} else if self.no_demo {
eprintln!("Not running federation-demo as requested.");
eprintln!("Flag --no-demo is the default now. Not running federation-demo.");
Box::new(())
} else if !self.with_demo {
eprintln!("Not running federation-demo.");
Box::new(())
} else {
let demo = FederationDemoRunner::new()?;
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/federation_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl FederationDemoRunner {

eprintln!("Waiting for service to be ready...");
loop {
match reqwest::blocking::get("http://localhost:4000/graphql") {
match reqwest::blocking::get("http://localhost:4100/graphql") {
Ok(_) => break,
Err(err) => eprintln!("{}", err),
}
Expand Down

0 comments on commit d7bad91

Please sign in to comment.