Skip to content

Commit cc2827b

Browse files
committed
Add path to k8s tests
1 parent 33eea3c commit cc2827b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Jenkinsfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,15 @@ void resultNotification(message) {
116116

117117
void lint() {
118118
sh '''
119+
# Added to fix 'Context loading failed error'
120+
go get ./...
119121
echo Installing golangci-lint
120122
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.50.0
121-
make lint saveOutput=true path=/home/builder/go/bin/
122-
echo helm template lint output: ;echo; helm-lint-output.txt; echo all tests lint output: ;echo; test-lint-output.txt
123+
make lint saveOutput=true path=./bin/
124+
echo helm template lint output: ;cat helm-lint-output.txt ;echo all tests lint output: ;cat test-lint-output.txt
123125
'''
124126

125-
LINT_OUTPUT = sh(returnStdout: true, script: 'echo helm template lint output: ;echo; helm-lint-output.txt; echo all tests lint output: ;echo; test-lint-output.txt').trim()
127+
LINT_OUTPUT = sh(returnStdout: true, script: 'echo helm template lint output: ;cat helm-lint-output.txt ;echo all tests lint output: ;cat test-lint-output.txt').trim()
126128

127129
sh '''
128130
rm -f helm-lint-output.txt test-lint-output.txt
@@ -195,7 +197,7 @@ pipeline {
195197
expression { return params.KUBERNETES_TESTS }
196198
}
197199
steps {
198-
sh "make test dockerImage=marklogic-centos/marklogic-server-centos:${dockerVersion} saveOutput=true"
200+
sh "go install gotest.tools/gotestsum@latest; make test dockerImage=marklogic-centos/marklogic-server-centos:${dockerVersion} saveOutput=true path=./bin/"
199201
}
200202
}
201203
}

makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ prepare:
6767
.PHONY: lint
6868
lint:
6969
@echo "> Linting helm charts....."
70-
helm lint --with-subcharts charts/ $(if $(saveOutput), > helm-lint-output.txt,)
70+
helm lint --with-subcharts charts/ $(if $(saveOutput),> helm-lint-output.txt,)
7171

7272
@echo "> Linting all tests....."
73-
$(if $(path),$(path),)golangci-lint run $(if $(saveOutput), > test-lint-output.txt,)
73+
$(if $(path),$(path),)golangci-lint run $(if $(saveOutput),> test-lint-output.txt,)
7474

7575
## ---------- Testing Tasks ----------
7676

@@ -81,6 +81,7 @@ lint:
8181
## Options:
8282
## * [dockerImage] optional. default is marklogicdb/marklogic-db:latest. Example: dockerImage=marklogic-centos/marklogic-server-centos:10-internal
8383
## * [saveOutput] optional. Save the output to a xml file. Example: saveOutput=true
84+
## * [path] optional. path to gotestsum executable. Example: path=/home/builder/go/bin/
8485
.PHONY: e2e-test
8586
e2e-test: prepare
8687
@echo "=====Installing minikube cluster"
@@ -90,7 +91,7 @@ e2e-test: prepare
9091
minikube image load $(dockerImage)
9192

9293
@echo "=====Running e2e tests"
93-
cd test; $(if $(saveOutput), gotestsum --junitfile test_results/e2e-tests.xml ./e2e/... -count=1, go test -v -count=1 ./test/e2e/...)
94+
cd test; $(if $(saveOutput),$(if $(path),$(path),)gotestsum --junitfile test_results/e2e-tests.xml ./e2e/... -count=1, go test -v -count=1 ./test/e2e/...)
9495

9596
@echo "=====Delete minikube cluster"
9697
minikube delete

0 commit comments

Comments
 (0)