Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit d3ecd6b

Browse files
By default, test without Kind (#524)
1 parent e89e66d commit d3ecd6b

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ jobs:
2222
- name: Go mod download and go tidy
2323
run: make setup
2424
- name: Run tests
25+
env:
26+
USE_KIND: "true"
2527
run: make test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ If you'd like to fix a bug, contribute a feature or just correct a typo, please
340340
1. Add your forked repo as a fork: `git remote add fork https://github.com/you-are-awesome/kubeaudit`
341341
1. Create your feature branch: `git checkout -b awesome-new-feature`
342342
1. Install [Kind](https://kind.sigs.k8s.io/#installation-and-usage)
343-
1. Run the tests to see everything is working as expected: `make test` (to run tests without Kind: `USE_KIND=false make test`)
343+
1. Run the tests to see everything is working as expected: `USE_KIND=true make test` (to run tests without Kind: `make test`)
344344
1. Commit your changes: `git commit -am 'Adds awesome feature'`
345345
1. Push to the branch: `git push fork`
346346
1. Sign the [Contributor License Agreement](https://cla.shopify.com/)

internal/test/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func GetAllFileNames(t *testing.T, directory string) []string {
137137

138138
// UseKind returns true if tests which utilize Kind should run
139139
func UseKind() bool {
140-
return os.Getenv("USE_KIND") != "false"
140+
return os.Getenv("USE_KIND") == "true"
141141
}
142142

143143
func ApplyManifest(t *testing.T, manifestPath, namespace string) {

kubeaudit_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package kubeaudit_test
22

33
import (
4-
"os"
54
"testing"
65

76
"github.com/Shopify/kubeaudit"
@@ -29,7 +28,7 @@ func TestNew(t *testing.T) {
2928
}
3029

3130
func TestAuditLocal(t *testing.T) {
32-
if os.Getenv("USE_KIND") == "false" {
31+
if !test.UseKind() {
3332
return
3433
}
3534

test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ set -e
55
echo "Starting tests. This may take a while..."
66

77
function finish {
8-
if [ "$USE_KIND" != "false" ] ; then
8+
if [ "$USE_KIND" == "true" ] ; then
99
make test-teardown
1010
fi
1111
}
1212
trap finish EXIT
1313

14-
if [ "$USE_KIND" != "false" ] ; then
14+
if [ "$USE_KIND" == "true" ] ; then
1515
make test-setup
1616
fi
1717

0 commit comments

Comments
 (0)