Skip to content

Commit

Permalink
Update k3s CI to run all integration tests (#4358)
Browse files Browse the repository at this point in the history
* Update k3s integration CI so all tests run
* Add check for ipv6 to skip test in Github CI
Signed-off-by: dereknola <derek.nola@suse.com>
  • Loading branch information
dereknola authored Nov 2, 2021
1 parent 94c1b98 commit aa33320
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
chmod +x ./dist/artifacts/k3s
go test -coverpkg=./... -coverprofile=coverage.out ./pkg/... -run Integration
go tool cover -func coverage.out
# these tests do not relate to coverage and must be run separately
go test ./tests/integration/... -run Integration
- name: On Failure, Launch Debug Session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/dualstack/dualstack_int_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
"os"
"strings"
"testing"

Expand All @@ -18,7 +19,7 @@ var dualStackServerArgs = []string{
"--disable-network-policy",
}
var _ = BeforeSuite(func() {
if !testutil.IsExistingServer() {
if !testutil.IsExistingServer() && os.Getenv("CI") != "" {
var err error
dualStackServer, err = testutil.K3sStartServer(dualStackServerArgs...)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -29,6 +30,8 @@ var _ = Describe("dual stack", func() {
BeforeEach(func() {
if testutil.IsExistingServer() && !testutil.ServerArgsPresent(dualStackServerArgs) {
Skip("Test needs k3s server with: " + strings.Join(dualStackServerArgs, " "))
} else if os.Getenv("CI") == "true" {
Skip("Github environment does not support IPv6")
}
})
When("a ipv4 and ipv6 cidr is present", func() {
Expand All @@ -48,7 +51,7 @@ var _ = Describe("dual stack", func() {
})

var _ = AfterSuite(func() {
if !testutil.IsExistingServer() {
if !testutil.IsExistingServer() && os.Getenv("CI") != "" {
Expect(testutil.K3sKillServer(dualStackServer)).To(Succeed())
}
})
Expand Down
2 changes: 1 addition & 1 deletion tests/util/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func K3sKillServer(server *K3sServer) error {
return err
}
if !flock.CheckLock(lockFile) {
return os.Remove(lockFile)
return os.RemoveAll(lockFile)
}
return nil
}

0 comments on commit aa33320

Please sign in to comment.