From 90e8ef26624a62abf411e54130f9ff6cb6405acd Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Wed, 24 Apr 2024 16:05:08 +0300 Subject: [PATCH] Skip integration tests when running `make test` and run them with `make integration` Signed-off-by: Dimitris Karakasilis --- .github/workflows/ci.yaml | 2 ++ Makefile | 4 +++- tests/integration_test.go | 3 +++ tests/integrations/enroll_keys/enroll_keys_test.go | 3 +++ tests/integrations/enroll_keys/secure_boot_enabled_test.go | 3 +++ .../list_enrolled_keys/list_enrolled_keys_test.go | 3 +++ 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 709807a..f8039d1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,6 +11,7 @@ jobs: - run: git config --global --add safe.directory $(pwd) - run: make - run: make test + - run: make integration - run: GOBIN=/usr/bin make lint void: runs-on: ubuntu-latest @@ -23,4 +24,5 @@ jobs: - run: git config --global --add safe.directory $(pwd) - run: make - run: make test + - run: make integration - run: GOBIN=/usr/bin make lint diff --git a/Makefile b/Makefile index 789675b..08453db 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,9 @@ test: .PHONY: integration integration: - go test -v tests/integration_test.go + # vmtest doesn't allow provide a way to pass --tags to the command that compiles + # the test (see: vmtest.RunGoTestsInVM) so we pass it as an env variable. + GOFLAGS=--tags=integration go test -v tests/integration_test.go .PHONY: local-aur .ONESHELL: diff --git a/tests/integration_test.go b/tests/integration_test.go index 035a2fe..ce006ba 100644 --- a/tests/integration_test.go +++ b/tests/integration_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + package tests import ( diff --git a/tests/integrations/enroll_keys/enroll_keys_test.go b/tests/integrations/enroll_keys/enroll_keys_test.go index 1e96250..c72c795 100644 --- a/tests/integrations/enroll_keys/enroll_keys_test.go +++ b/tests/integrations/enroll_keys/enroll_keys_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + package main import ( diff --git a/tests/integrations/enroll_keys/secure_boot_enabled_test.go b/tests/integrations/enroll_keys/secure_boot_enabled_test.go index c64861c..ec1b7b8 100644 --- a/tests/integrations/enroll_keys/secure_boot_enabled_test.go +++ b/tests/integrations/enroll_keys/secure_boot_enabled_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + package main import ( diff --git a/tests/integrations/list_enrolled_keys/list_enrolled_keys_test.go b/tests/integrations/list_enrolled_keys/list_enrolled_keys_test.go index 47a09de..66d5217 100644 --- a/tests/integrations/list_enrolled_keys/list_enrolled_keys_test.go +++ b/tests/integrations/list_enrolled_keys/list_enrolled_keys_test.go @@ -1,3 +1,6 @@ +//go:build integration +// +build integration + package main import (