Skip to content

Commit 7b2ac0b

Browse files
committed
Ignore test that is failing for external reasons
Signed-off-by: Ryan Levick <[email protected]>
1 parent 990017f commit 7b2ac0b

File tree

15 files changed

+131
-88
lines changed

15 files changed

+131
-88
lines changed

.github/actions/spin-ci-dependencies/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ inputs:
7272
required: false
7373
type: string
7474

75+
docker:
76+
description: 'setup docker'
77+
required: false
78+
default: 'false'
79+
type: bool
80+
7581
runs:
7682
using: "composite"
7783
steps:

.github/workflows/build.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
if: failure()
4949
uses: andymckay/[email protected]
5050

51-
## This is separated out to remove e2e-tests dependency on windows/mac builds
51+
## This is separated out to remove full integration tests dependencies on windows/mac builds
5252
build-rust-ubuntu:
5353
name: Build Spin Ubuntu
5454
runs-on: ubuntu-latest
@@ -157,11 +157,15 @@ jobs:
157157
rust-cache: true
158158
nomad: true
159159

160-
- name: Cargo Unit and Integration Tests
160+
- name: Run Unit Tests
161161
run: |
162-
make test-unit test-integration
163-
env:
164-
CARGO_INCREMENTAL: 0
162+
make test-unit
163+
164+
- name: Run Integration Tests
165+
run: |
166+
make test-integration
167+
# Only run integration tests on macOS as they will be run on ubuntu separately
168+
if: ${{ matrix.runner == 'macos-latest' }}
165169

166170
test-go:
167171
name: Test Spin SDK - Go
@@ -193,7 +197,7 @@ jobs:
193197
- name: "Test Go SDK"
194198
run: make test-sdk-go
195199

196-
e2e-tests:
200+
all-integration-tests:
197201
# run on a larger runner for more SSD/resource access
198202
runs-on: ubuntu-22.04-4core-spin
199203
if: ${{ github.repository_owner == 'fermyon' }}
@@ -225,6 +229,6 @@ jobs:
225229
mv grain-linux-x64 grain
226230
echo "$PWD" >> $GITHUB_PATH
227231
228-
- name: Run e2e tests
232+
- name: Run Full Integration Tests
229233
run: |
230-
make test-spin-up
234+
make test-integration-full

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ wit-component = "0.19.0"
108108

109109
[features]
110110
default = ["llm"]
111-
all-tests = ["e2e-tests"]
112-
e2e-tests = []
111+
all-tests = ["extern-dependencies-tests"]
112+
extern-dependencies-tests = []
113113
llm = ["spin-trigger-http/llm"]
114114
llm-metal = ["llm", "spin-trigger-http/llm-metal"]
115115
llm-cublas = ["llm", "spin-trigger-http/llm-cublas"]

Makefile

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,6 @@ CERT_NAME ?= local
33
SPIN_DOC_NAME ?= new-doc.md
44
export PATH := target/debug:target/release:$(HOME)/.cargo/bin:$(PATH)
55

6-
ARCH = $(shell uname -p)
7-
8-
## dependencies for e2e-tests
9-
E2E_BUILD_SPIN ?= false
10-
E2E_FETCH_SPIN ?= true
11-
E2E_TESTS_DOCKERFILE ?= e2e-tests.Dockerfile
12-
MYSQL_IMAGE ?= mysql:8.0.22
13-
REDIS_IMAGE ?= redis:7.0.8-alpine3.17
14-
POSTGRES_IMAGE ?= postgres:14.7-alpine
15-
REGISTRY_IMAGE ?= registry:2
16-
E2E_SPIN_RELEASE_VOLUME_MOUNT ?=
17-
E2E_SPIN_DEBUG_VOLUME_MOUNT ?=
18-
19-
## overrides for aarch64
20-
ifneq ($(ARCH),x86_64)
21-
MYSQL_IMAGE = arm64v8/mysql:8.0.32
22-
REDIS_IMAGE = arm64v8/redis:6.0-alpine3.17
23-
POSTGRES_IMAGE = arm64v8/postgres:14.7
24-
REGISTRY_IMAGE = arm64v8/registry:2
25-
E2E_TESTS_DOCKERFILE = e2e-tests-aarch64.Dockerfile
26-
endif
27-
28-
ifneq (,$(wildcard $(shell pwd)/target/release/spin))
29-
E2E_SPIN_RELEASE_VOLUME_MOUNT = -v $(shell pwd)/target/release/spin:/from-host/target/release/spin
30-
endif
31-
32-
ifneq (,$(wildcard $(shell pwd)/target/debug/spin))
33-
E2E_SPIN_DEBUG_VOLUME_MOUNT = -v $(shell pwd)/target/debug/spin:/from-host/target/debug/spin
34-
endif
35-
36-
## Reset volume mounts for e2e-tests if Darwin because the
37-
## spin binaries built on macOS won't run in the docker container
38-
ifeq ($(shell uname -s),Darwin)
39-
E2E_SPIN_RELEASE_VOLUME_MOUNT =
40-
E2E_SPIN_DEBUG_VOLUME_MOUNT =
41-
E2E_BUILD_SPIN = true
42-
endif
43-
446
## overrides for Windows
457
ifeq ($(OS),Windows_NT)
468
LOG_LEVEL_VAR =
@@ -87,20 +49,21 @@ update-cargo-locks:
8749

8850
.PHONY: test-unit
8951
test-unit:
90-
$(LOG_LEVEL_VAR) cargo test --all --no-fail-fast -- --skip integration_tests --skip spinup_tests --skip cloud_tests --nocapture
52+
$(LOG_LEVEL_VAR) cargo test --all --no-fail-fast -- --skip integration_tests --nocapture
9153

9254
.PHONY: test-crate
9355
test-crate:
94-
$(LOG_LEVEL_VAR) cargo test -p $(crate) --no-fail-fast -- --skip integration_tests --skip spinup_tests --skip cloud_tests --nocapture
56+
$(LOG_LEVEL_VAR) cargo test -p $(crate) --no-fail-fast -- --skip integration_tests --nocapture
9557

58+
# Run the integration tests without the tests that use some sort of assumed external depedency (e.g., Docker, a language toolchain, etc.)
9659
.PHONY: test-integration
9760
test-integration:
98-
cargo test -F e2e-tests -- runtime_tests --nocapture; \
99-
$(LOG_LEVEL_VAR) cargo test --test integration --no-fail-fast -- --skip spinup_tests --skip cloud_tests --nocapture
61+
cargo test --release integration_tests --no-default-features --no-fail-fast -- --nocapture
10062

101-
.PHONY: test-spin-up
102-
test-spin-up:
103-
cargo test --release spinup_tests --no-default-features --features e2e-tests --no-fail-fast -- --nocapture
63+
# Run all of the integration tests including those that use some sort of assumed external depedency (e.g., Docker, a language toolchain, etc.)
64+
.PHONY: test-integration-full
65+
test-integration-full:
66+
cargo test --release integration_tests --no-default-features --features extern-dependencies-tests --no-fail-fast -- --nocapture
10467

10568
.PHONY: test-sdk-go
10669
test-sdk-go:

crates/templates/src/test_built_ins/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![cfg(test)]
22

3-
// Module for unit-testing the built-in templates when a full e2e test would be overkill.
3+
// Module for unit-testing the built-in templates when a full integration test would be overkill.
44
// If your test involves invoking the Spin CLI, or builds or runs an application, use
5-
// an e2e test.
5+
// an integration test.
66

77
use std::{collections::HashMap, path::PathBuf};
88

crates/test-codegen-macro/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ test = false
1212
[dependencies]
1313
heck = "0.4.0"
1414
quote = "1.0.32"
15+
syn = "2.0"

crates/test-codegen-macro/src/lib.rs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ use std::{env, path::PathBuf};
44

55
/// This macro generates the `#[test]` functions for the runtime tests.
66
#[proc_macro]
7-
pub fn codegen_runtime_tests(_input: TokenStream) -> TokenStream {
7+
pub fn codegen_runtime_tests(input: TokenStream) -> TokenStream {
8+
let input = syn::parse_macro_input!(input);
9+
let ignores = ignores(input);
810
let mut tests = Vec::new();
911
let tests_path =
1012
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/runtime-tests/tests");
@@ -20,9 +22,14 @@ pub fn codegen_runtime_tests(_input: TokenStream) -> TokenStream {
2022
let requires_services = entry.path().join("services").exists();
2123

2224
let name = test.file_stem().unwrap().to_str().unwrap();
25+
let ignore = if ignores.contains(&name.to_string()) {
26+
quote::quote!(#[ignore])
27+
} else {
28+
quote::quote!()
29+
};
2330
let ident = quote::format_ident!("{}", name.to_snake_case());
2431
let feature_attribute = if requires_services {
25-
quote::quote!(#[cfg(feature = "e2e-tests")])
32+
quote::quote!(#[cfg(feature = "extern-dependencies-tests")])
2633
} else {
2734
quote::quote!()
2835
};
@@ -35,6 +42,7 @@ pub fn codegen_runtime_tests(_input: TokenStream) -> TokenStream {
3542
// ```
3643
tests.push(quote::quote! {
3744
#[test]
45+
#ignore
3846
#feature_attribute
3947
fn #ident() {
4048
run(::std::path::PathBuf::from(#tests_path_string).join(#name))
@@ -44,3 +52,26 @@ pub fn codegen_runtime_tests(_input: TokenStream) -> TokenStream {
4452
}
4553
(quote::quote!(#(#tests)*)).into()
4654
}
55+
56+
fn ignores(input: syn::FieldValue) -> Vec<String> {
57+
let syn::Member::Named(n) = input.member else {
58+
panic!("codegen_runtime_tests!() requires a named field");
59+
};
60+
if n != "ignore" {
61+
panic!("codegen_runtime_tests!() only supports the `ignore` field");
62+
}
63+
let syn::Expr::Array(a) = input.expr else {
64+
panic!("codegen_runtime_tests!() requires an array of strings");
65+
};
66+
a.elems
67+
.iter()
68+
.map(|e| {
69+
if let syn::Expr::Lit(l) = e {
70+
if let syn::Lit::Str(s) = &l.lit {
71+
return s.value();
72+
}
73+
}
74+
panic!("codegen_runtime_tests!() requires an array of strings");
75+
})
76+
.collect()
77+
}

tests/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ The runtime tests are handled through the `runtime-tests` support crate. See the
2323
You can run runtime tests like so:
2424

2525
```bash
26-
cargo test runtime_tests -F e2e-tests
26+
cargo test runtime_tests -F extern-dependencies-tests
2727
```
2828

2929
# Integration tests
3030

3131
Integration tests are meant to test anything that cannot be tested through some other testing mechanism usually because the scenario under test is complicated and involves the interaction between many different subsystems. Historically, integration tests have been a landing pad for experimentation around testing that have eventually been turned into their own class of tests.
3232

33-
Currently, integration tests are split between two different modules that will soon be combined into one: `integration_tests` and `spinup_tests`.
34-
3533
You can run integration tests like so:
3634
```bash
3735
make test-integration
38-
make test-spin-up
3936
```
37+
38+
Note that this also runs the runtime tests as well.

0 commit comments

Comments
 (0)