Skip to content

Commit

Permalink
enable sidecarset e2e parallelism feature
Browse files Browse the repository at this point in the history
Signed-off-by: Abner-1 <[email protected]>
  • Loading branch information
ABNER-1 committed Feb 5, 2025
1 parent 1552292 commit a8c1a9d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e-1.30.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
- name: Run E2E Tests
run: |
export KUBECONFIG=/home/runner/.kube/config
tools/hack/run-kruise-e2e-test.sh --focus '\[apps\] SidecarSet' --print-info --disable-parallel
tools/hack/run-kruise-e2e-test.sh --focus '\[apps\] SidecarSet' --print-info
ephemeraljob:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
- name: Run E2E Tests
run: |
export KUBECONFIG=/home/runner/.kube/config
tools/hack/run-kruise-e2e-test.sh --focus '\[policy\] PodUnavailableBudget' --print-info --disable-parallel
tools/hack/run-kruise-e2e-test.sh --focus '\[policy\] PodUnavailableBudget' --print-info
clonesetAndInplace:
runs-on: ubuntu-20.04
Expand Down
10 changes: 6 additions & 4 deletions test/e2e/apps/sidecarset.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import (
"strconv"
"time"

v1core "k8s.io/client-go/kubernetes/typed/core/v1"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
kruiseclientset "github.com/openkruise/kruise/pkg/client/clientset/versioned"
"github.com/openkruise/kruise/pkg/control/sidecarcontrol"
"github.com/openkruise/kruise/pkg/util"
"github.com/openkruise/kruise/pkg/util/configuration"
"github.com/openkruise/kruise/test/e2e/framework"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"

"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
Expand All @@ -47,6 +48,7 @@ import (
)

var _ = SIGDescribe("SidecarSet", func() {
framework.TestContext.DeleteNamespaceOnFailure = false
f := framework.NewDefaultFramework("sidecarset")
var ns string
var c clientset.Interface
Expand All @@ -66,7 +68,7 @@ var _ = SIGDescribe("SidecarSet", func() {
framework.DumpDebugInfo(c, ns)
}
framework.Logf("Deleting all SidecarSet in cluster")
tester.DeleteSidecarSets()
tester.DeleteSidecarSets(ns)
tester.DeleteDeployments(ns)
})
framework.ConformanceIt("pods don't have matched sidecarSet", func() {
Expand Down Expand Up @@ -652,14 +654,14 @@ var _ = SIGDescribe("SidecarSet", func() {
})*/
})

framework.KruiseDescribe("SidecarSet Upgrade functionality [SidecarSeUpgrade]", func() {
framework.KruiseDescribe("SidecarSet Upgrade functionality [SidecarSetUpgrade]", func() {

ginkgo.AfterEach(func() {
if ginkgo.CurrentGinkgoTestDescription().Failed {
framework.DumpDebugInfo(c, ns)
}
framework.Logf("Deleting all SidecarSet in cluster")
tester.DeleteSidecarSets()
tester.DeleteSidecarSets(ns)
tester.DeleteDeployments(ns)
})

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/apps/sidecarset_hotupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var _ = SIGDescribe("SidecarSet", func() {
framework.DumpDebugInfo(c, ns)
}
framework.Logf("Deleting all SidecarSet in cluster")
tester.DeleteSidecarSets()
tester.DeleteSidecarSets(ns)
tester.DeleteDeployments(ns)
})

Expand Down
12 changes: 9 additions & 3 deletions test/e2e/framework/sidecarset_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ package framework

import (
"context"
"fmt"
"time"

"k8s.io/utils/ptr"

appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
kruiseclientset "github.com/openkruise/kruise/pkg/client/clientset/versioned"
"github.com/openkruise/kruise/pkg/control/sidecarcontrol"
"github.com/openkruise/kruise/pkg/util"
webhookutil "github.com/openkruise/kruise/pkg/webhook/util"
"k8s.io/utils/ptr"

"github.com/onsi/gomega"
apps "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -58,7 +60,8 @@ func (s *SidecarSetTester) NewBaseSidecarSet(ns string) *appsv1alpha1.SidecarSet
APIVersion: "apps.kruise.io/v1alpha1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-sidecarset",

Name: fmt.Sprintf("test-sidecarset-%s", ns),
Labels: map[string]string{
"app": "sidecar",
},
Expand Down Expand Up @@ -226,14 +229,17 @@ func (s *SidecarSetTester) CreateDeployment(deployment *apps.Deployment) {
s.WaitForDeploymentRunning(deployment)
}

func (s *SidecarSetTester) DeleteSidecarSets() {
func (s *SidecarSetTester) DeleteSidecarSets(ns string) {
sidecarSetList, err := s.kc.AppsV1alpha1().SidecarSets().List(context.TODO(), metav1.ListOptions{})
if err != nil {
Logf("List sidecarSets failed: %s", err.Error())
return
}

for _, sidecarSet := range sidecarSetList.Items {
if sidecarSet.Namespace != ns {
continue
}
s.DeleteSidecarSet(&sidecarSet)
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/policy/podunavailablebudget.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var _ = SIGDescribe("PodUnavailableBudget", func() {
tester.DeletePubs(ns)
tester.DeleteDeployments(ns)
tester.DeleteCloneSets(ns)
sidecarTester.DeleteSidecarSets()
sidecarTester.DeleteSidecarSets(ns)
})

ginkgo.It("PodUnavailableBudget selector no matched pods", func() {
Expand Down

0 comments on commit a8c1a9d

Please sign in to comment.