Skip to content

Commit

Permalink
Merge pull request containerd#3338 from apostasie/f-dev-kube-ci-after…
Browse files Browse the repository at this point in the history
…math

Kubernetes minor cleanup (rename and -f on delete)
  • Loading branch information
fahedouch authored Aug 24, 2024
2 parents 62c67b0 + 031aa1d commit a7db774
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test-kube.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This pipeline purpose is solely meant to run a subset of our test suites against a kube cluster
name: kube
# This pipeline purpose is solely meant to run a subset of our test suites against a kubernetes cluster
name: kubernetes

on:
push:
Expand All @@ -21,7 +21,7 @@ jobs:
- uses: actions/[email protected]
with:
fetch-depth: 1
- name: "Run Kube integration tests"
- name: "Run Kubernetes integration tests"
run: |
./hack/build-integration-kube.sh
sudo ./_output/nerdctl exec nerdctl-test-control-plane bash -c -- 'export TMPDIR="$HOME"/tmp; mkdir -p "$TMPDIR"; cd /nerdctl-source; /usr/local/go/bin/go test ./cmd/nerdctl/ -test.only-kube'
./hack/build-integration-kubernetes.sh
sudo ./_output/nerdctl exec nerdctl-test-control-plane bash -c -- 'export TMPDIR="$HOME"/tmp; mkdir -p "$TMPDIR"; cd /nerdctl-source; /usr/local/go/bin/go test ./cmd/nerdctl/ -test.only-kubernetes'
4 changes: 2 additions & 2 deletions cmd/nerdctl/container_commit_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func TestKubeCommitPush(t *testing.T) {
t.Parallel()

base := testutil.NewBaseForKube(t)
base := testutil.NewBaseForKubernetes(t)
tID := testutil.Identifier(t)

var containerID string
Expand All @@ -49,7 +49,7 @@ func TestKubeCommitPush(t *testing.T) {
}

tearDown := func() {
testutil.KubectlHelper(base, "delete", "pod", tID).Run()
testutil.KubectlHelper(base, "delete", "pod", "-f", tID).Run()
}

tearDown()
Expand Down
File renamed without changes.
52 changes: 26 additions & 26 deletions pkg/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ import (
)

type Base struct {
T testing.TB
Target Target
DaemonIsKillable bool
EnableIPv6 bool
IPv6Compatible bool
EnableKube bool
KubeCompatible bool
Binary string
Args []string
Env []string
T testing.TB
Target Target
DaemonIsKillable bool
EnableIPv6 bool
IPv6Compatible bool
EnableKubernetes bool
KubernetesCompatible bool
Binary string
Args []string
Env []string
}

// WithStdin sets the standard input of Cmd to the specified reader
Expand Down Expand Up @@ -550,7 +550,7 @@ func M(m *testing.M) {
flag.StringVar(&flagTestTarget, "test.target", Nerdctl, "target to test")
flag.BoolVar(&flagTestKillDaemon, "test.allow-kill-daemon", false, "enable tests that kill the daemon")
flag.BoolVar(&flagTestIPv6, "test.only-ipv6", false, "enable tests on IPv6")
flag.BoolVar(&flagTestKube, "test.only-kube", false, "enable tests on Kube")
flag.BoolVar(&flagTestKube, "test.only-kubernetes", false, "enable tests on Kubernetes")
flag.Parse()
fmt.Fprintf(os.Stderr, "test target: %q\n", flagTestTarget)
os.Exit(m.Run())
Expand All @@ -567,7 +567,7 @@ func GetEnableIPv6() bool {
return flagTestIPv6
}

func GetEnableKube() bool {
func GetEnableKubernetes() bool {
return flagTestKube
}

Expand Down Expand Up @@ -701,7 +701,7 @@ func NewBaseWithIPv6Compatible(t *testing.T) *Base {
return newBase(t, Namespace, true, false)
}

func NewBaseForKube(t *testing.T) *Base {
func NewBaseForKubernetes(t *testing.T) *Base {
base := newBase(t, "k8s.io", false, true)
// NOTE: kubectl namespaces are not the same as containerd namespaces.
// We still want kube test objects segregated in their own Kube API namespace.
Expand All @@ -713,26 +713,26 @@ func NewBase(t *testing.T) *Base {
return newBase(t, Namespace, false, false)
}

func newBase(t *testing.T, ns string, ipv6Compatible bool, kubeCompatible bool) *Base {
func newBase(t *testing.T, ns string, ipv6Compatible bool, kubernetesCompatible bool) *Base {
base := &Base{
T: t,
Target: GetTarget(),
DaemonIsKillable: GetDaemonIsKillable(),
EnableIPv6: GetEnableIPv6(),
IPv6Compatible: ipv6Compatible,
EnableKube: GetEnableKube(),
KubeCompatible: kubeCompatible,
Env: os.Environ(),
T: t,
Target: GetTarget(),
DaemonIsKillable: GetDaemonIsKillable(),
EnableIPv6: GetEnableIPv6(),
IPv6Compatible: ipv6Compatible,
EnableKubernetes: GetEnableKubernetes(),
KubernetesCompatible: kubernetesCompatible,
Env: os.Environ(),
}
if base.EnableIPv6 && !base.IPv6Compatible {
t.Skip("runner skips non-IPv6 compatible tests in the IPv6 environment")
} else if !base.EnableIPv6 && base.IPv6Compatible {
t.Skip("runner skips IPv6 compatible tests in the non-IPv6 environment")
}
if base.EnableKube && !base.KubeCompatible {
t.Skip("runner skips non-kube compatible tests in the kube environment")
} else if !base.EnableKube && base.KubeCompatible {
t.Skip("runner skips kube compatible tests in the non-kube environment")
if base.EnableKubernetes && !base.KubernetesCompatible {
t.Skip("runner skips non-Kubernetes compatible tests in the Kubernetes environment")
} else if !base.EnableKubernetes && base.KubernetesCompatible {
t.Skip("runner skips Kubernetes compatible tests in the non-Kubernetes environment")
}
var err error
switch base.Target {
Expand Down

0 comments on commit a7db774

Please sign in to comment.