-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ii2day <ji.li@daocloud.io>
- Loading branch information
ii2day
committed
Jun 28, 2023
1 parent
e08bac9
commit ce5ca04
Showing
16 changed files
with
1,648 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# E2E Cases for AppHttpHealth | ||
|
||
| Case ID | Title | Priority | Smoke | Status | Other | | ||
|---------|-----------------------------------------------------------------------------|----------|-------|--------|-------------| | ||
| A00001 | Successfully http testing appHttpHealth method GET case | p1 | | done | | | ||
| A00002 | Failed http testing appHttpHealth due to status code case | p1 | | done | | | ||
| A00003 | Failed http testing appHttpHealth due to delay case | p1 | | done | | | ||
| A00004 | Successfully https testing appHttpHealth method GET case | p1 | | done | | | ||
| A00005 | Failed https testing appHttpHealth due to tls case | p1 | | done | | | ||
| A00006 | Successfully http testing appHttpHealth method PUT case | p1 | | done | | | ||
| A00007 | Successfully http testing appHttpHealth method POST With Body case | p1 | | done | | | ||
| A00008 | Successfully http testing appHttpHealth method HEAD case | p1 | | done | | | ||
| A00009 | Successfully http testing appHttpHealth method PATCH case | p1 | | done | | | ||
| A000010 | Successfully http testing appHttpHealth method OPTIONS case | p1 | | done | | | ||
| A000011 | After QPS is specified, the number of requests meets the requirements case | p1 | | done | | | ||
| A000012 | Successfully http testing appHttpHealth due to success rate case | p1 | | done | | | ||
| A000013 | Successfully https testing appHttpHealth method GET Protocol Http2 case | p1 | | done | | | ||
| A000014 | Report request count equal real request count case | p1 | | done | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# E2E Cases for IP NetReach | ||
|
||
| Case ID | Title | Priority | Smoke | Status | Other | | ||
|---------|--------------------------------------------------------|----------|-------|--------|-------------| | ||
| B00001 | Successfully testing netReach case | p1 | | done | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# E2E Cases for IP schedule | ||
|
||
| Case ID | Title | Priority | Smoke | Status | Other | | ||
|---------|-------------------------------------------------|----------|-------|--------|-------------| | ||
| C00001 | Successfully testing NetReach crontab case | p1 | | done | | | ||
| C00002 | Successfully testing AppHttpHealth crontab case | p1 | | done | | | ||
| C00003 | Successfully testing NetReach sample case | p1 | | done | | | ||
| C00004 | Successfully testing AppHttpHealth sample case | p1 | | done | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
// Copyright 2023 Authors of kdoctor-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package apphttphealth_test | ||
|
||
import ( | ||
"context" | ||
kdoctor_v1beta1 "github.com/kdoctor-io/kdoctor/pkg/k8s/apis/kdoctor.io/v1beta1" | ||
"github.com/kdoctor-io/kdoctor/test/e2e/common" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
e2e "github.com/spidernet-io/e2eframework/framework" | ||
"github.com/spidernet-io/e2eframework/tools" | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestNetReach(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "AppHttpHealth Suite") | ||
} | ||
|
||
var frame *e2e.Framework | ||
|
||
var commonSvcIP string | ||
var countSvcIP string | ||
var commonPodIPs = make([]string, 0) | ||
var countPodIPs = make([]string, 0) | ||
|
||
var httpPort = 80 | ||
var httpsPort = 443 | ||
var bodyConfigMapName string | ||
var commonTestDsName string | ||
var countTestDsName string | ||
|
||
var _ = BeforeSuite(func() { | ||
defer GinkgoRecover() | ||
var e error | ||
frame, e = e2e.NewFramework(GinkgoT(), []func(*runtime.Scheme) error{kdoctor_v1beta1.AddToScheme}) | ||
Expect(e).NotTo(HaveOccurred()) | ||
|
||
// test request body | ||
bodyConfigMapName = "kdoctor-test-body-" + tools.RandomName() | ||
cm := new(v1.ConfigMap) | ||
cm.SetName(bodyConfigMapName) | ||
cm.SetNamespace(common.TestNameSpace) | ||
body := make(map[string]string, 0) | ||
body["test1"] = "test1" | ||
body["test2"] = "test2" | ||
cm.Data = body | ||
e = frame.CreateConfigmap(cm) | ||
Expect(e).NotTo(HaveOccurred(), "create test body configmap") | ||
|
||
// test pod | ||
commonTestDsName = "kdoctor-test-server-" + tools.RandomName() | ||
commonKey := metav1.ObjectMeta{ | ||
Name: commonTestDsName, | ||
Namespace: common.TestNameSpace, | ||
Labels: map[string]string{"app": commonTestDsName}, | ||
} | ||
e = common.CreateDaemonSetAndService(frame, commonKey, true, false) | ||
Expect(e).NotTo(HaveOccurred(), "create common test daemonSet and service") | ||
|
||
// count test pod | ||
countTestDsName = "kdoctor-test-server-" + tools.RandomName() | ||
countKey := metav1.ObjectMeta{ | ||
Name: countTestDsName, | ||
Namespace: common.TestNameSpace, | ||
Labels: map[string]string{"app": countTestDsName}, | ||
} | ||
e = common.CreateDaemonSetAndService(frame, countKey, true, true) | ||
Expect(e).NotTo(HaveOccurred(), "create count test daemonSet and service") | ||
// wait test ds ready | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) | ||
defer cancel() | ||
_, e = frame.WaitDaemonSetReady(commonTestDsName, common.TestNameSpace, ctx) | ||
Expect(e).NotTo(HaveOccurred(), "wait common test daemonSet and service ready") | ||
ctx2, cancel2 := context.WithTimeout(context.Background(), time.Second*60) | ||
defer cancel2() | ||
_, e = frame.WaitDaemonSetReady(countTestDsName, common.TestNameSpace, ctx2) | ||
Expect(e).NotTo(HaveOccurred(), "wait count test daemonSet and service ready") | ||
|
||
// get common test service ip and pod ip | ||
commonSvc, e := frame.GetService(commonTestDsName, common.TestNameSpace) | ||
Expect(e).NotTo(HaveOccurred(), "get kdoctor common test service") | ||
commonSvcIP = commonSvc.Spec.ClusterIP | ||
GinkgoWriter.Printf("get common service ip %v \n", commonSvcIP) | ||
|
||
commonDs, e := frame.GetDaemonSet(commonTestDsName, common.TestNameSpace) | ||
Expect(e).NotTo(HaveOccurred(), "get kdoctor common test daemonset") | ||
|
||
commonPods, e := frame.GetDaemonSetPodList(commonDs) | ||
Expect(e).NotTo(HaveOccurred(), "get kdoctor common test pod list") | ||
|
||
for _, v := range commonPods.Items { | ||
commonPodIPs = append(commonPodIPs, v.Status.PodIP) | ||
} | ||
|
||
GinkgoWriter.Printf("get common test pod ips %v \n", commonPodIPs) | ||
|
||
// get count test service ip and pod ip | ||
countSvc, e := frame.GetService(countTestDsName, common.TestNameSpace) | ||
Expect(e).NotTo(HaveOccurred(), "get kdoctor count test service") | ||
countSvcIP = countSvc.Spec.ClusterIP | ||
GinkgoWriter.Printf("get count service ip %v \n", countSvcIP) | ||
|
||
countDs, e := frame.GetDaemonSet(countTestDsName, common.TestNameSpace) | ||
Expect(e).NotTo(HaveOccurred(), "get kdoctor count test daemonset") | ||
|
||
countPods, e := frame.GetDaemonSetPodList(countDs) | ||
Expect(e).NotTo(HaveOccurred(), "get kdoctor count test pod list") | ||
|
||
for _, v := range countPods.Items { | ||
countPodIPs = append(countPodIPs, v.Status.PodIP) | ||
} | ||
|
||
GinkgoWriter.Printf("get count test pod ips %v \n", countPodIPs) | ||
|
||
}) | ||
|
||
var _ = AfterSuite(func() { | ||
defer GinkgoRecover() | ||
_ = frame.DeleteConfigmap(bodyConfigMapName, common.TestNameSpace) | ||
// common | ||
_ = frame.DeleteDaemonSet(commonTestDsName, common.TestNameSpace) | ||
_ = frame.DeleteService(commonTestDsName, common.TestNameSpace) | ||
// count | ||
_ = frame.DeleteDaemonSet(countTestDsName, common.TestNameSpace) | ||
_ = frame.DeleteService(countTestDsName, common.TestNameSpace) | ||
|
||
}) |
Oops, something went wrong.