File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ jobs:
24
24
- name : Build nginx-supportpkg binary
25
25
run : |
26
26
cd project
27
- go build -o nginx-supportpkg
28
- chmod +x nginx-supportpkg
29
- cp nginx-supportpkg /usr/local/bin/
30
- kubectl nginx-supportpkg
27
+ go build -o kubectl-nginx_supportpkg
28
+ chmod +x kubectl-nginx_supportpkg
29
+ cp kubectl-nginx_supportpkg /usr/local/bin/
30
+ kubectl nginx-supportpkg -v
31
31
32
32
- name : Run tests
33
33
run : go test ./tests -v
Original file line number Diff line number Diff line change @@ -7,18 +7,19 @@ import (
7
7
"testing"
8
8
)
9
9
10
- func TestKubectlCommands (t * testing.T ) {
11
- // Execute `kubectl` command
12
- cmd := exec .Command ("kubectl" , "nginx-supportpkg" )
10
+ func TestKubectlNginxSupportpkgVersion (t * testing.T ) {
11
+ cmd := exec .Command ("kubectl" , "nginx-supportpkg" , "-v" )
13
12
var stdout , stderr bytes.Buffer
14
13
cmd .Stdout = & stdout
15
14
cmd .Stderr = & stderr
16
- _ = cmd .Run ()
15
+ err := cmd .Run ()
16
+ if err != nil {
17
+ t .Errorf ("Failed to run 'kubectl nginx-supportpkg -v': %v" , err )
18
+ }
17
19
18
- // Compare the output with expected result
19
- expectedOutput := "required flag(s)"
20
+ expectedOutput := "nginx-supportpkg - version"
20
21
actualOutput := stdout .String ()
21
22
if ! strings .Contains (actualOutput , expectedOutput ) {
22
- t .Errorf ("Expected output should contain \" %s \" but got \" %s \" " , expectedOutput , actualOutput )
23
+ t .Errorf ("Expected output should contain '%s' but got '%s' " , expectedOutput , actualOutput )
23
24
}
24
25
}
You can’t perform that action at this time.
0 commit comments