parent
a9f6789070
commit
5ce16fc777
@ -1,2 +1,8 @@
|
||||
resources:
|
||||
- manager.yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
images:
|
||||
- name: controller
|
||||
newName: mashibing.com/deployment/msbdeployment
|
||||
newTag: v0.0.1
|
||||
|
@ -1,2 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite name="e2e" tests="0" failures="0" errors="0" time="434.56"></testsuite>
|
||||
<testsuite name="e2e" tests="0" failures="0" errors="0" time="446.979"></testsuite>
|
@ -0,0 +1,78 @@
|
||||
package create
|
||||
|
||||
import (
|
||||
"context"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"time"
|
||||
|
||||
"mashibing.com/pkg/mashibing-deployment/test/framework"
|
||||
)
|
||||
|
||||
// 真正的测试函数
|
||||
|
||||
// 测试创建Ingress模式
|
||||
func CreateIngressMsbDeployment(ctx *framework.TestContext, f *framework.Framework) {
|
||||
var (
|
||||
// 1. 准备测试数据
|
||||
ctFilePath = "create/testdata/create-ingress.yaml"
|
||||
obj = &unstructured.Unstructured{Object: make(map[string]interface{})}
|
||||
dc dynamic.Interface
|
||||
cs *kubernetes.Clientset
|
||||
|
||||
// 3. 准备测试用到的全局变量
|
||||
msbGVR = schema.GroupVersionResource{
|
||||
Group: "apps.mashibing.com",
|
||||
Version: "v1",
|
||||
Resource: "msbdeployments",
|
||||
}
|
||||
err error
|
||||
)
|
||||
BeforeEach(func() {
|
||||
// 2. 加载测试数据
|
||||
err = f.LoadYamlToUnstructured(ctFilePath, obj)
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
// 4. 初始化测试用到的全局变量
|
||||
dc = ctx.CreateDynamicClient()
|
||||
cs = ctx.CreateClientSet()
|
||||
})
|
||||
Context("Create msbdeployment mod ingress", func() {
|
||||
It("Should be create mod ingress success", func() {
|
||||
_, err = dc.Resource(msbGVR).Namespace("default").Create(context.TODO(), obj, metav1.CreateOptions{})
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
By("Sleep 1 second wait creating done")
|
||||
time.Sleep(time.Second)
|
||||
})
|
||||
It("Should be exist msbdeployment", func() {
|
||||
_, err = dc.Resource(msbGVR).Namespace("default").Get(context.TODO(), obj.GetName(), metav1.GetOptions{})
|
||||
Expect(err).Should(BeNil())
|
||||
})
|
||||
It("Should be exist deployment", func() {
|
||||
_, err = cs.AppsV1().Deployments("default").Get(context.TODO(), obj.GetName(), metav1.GetOptions{})
|
||||
Expect(err).Should(BeNil())
|
||||
})
|
||||
It("Should be exist service", func() {
|
||||
_, err = cs.CoreV1().Services("default").Get(context.TODO(), obj.GetName(), metav1.GetOptions{})
|
||||
Expect(err).Should(BeNil())
|
||||
})
|
||||
It("Should be exist ingress", func() {
|
||||
_, err = cs.NetworkingV1().Ingresses("default").Get(context.TODO(), obj.GetName(), metav1.GetOptions{})
|
||||
Expect(err).Should(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
Context("Delete msbdeployment mod ingress", func() {
|
||||
It("Should be delete mod ingress success", func() {})
|
||||
It("Should not be exist msbdeployment", func() {})
|
||||
It("Should not be exist deployment", func() {})
|
||||
It("Should not be exist service", func() {})
|
||||
It("Should not be exist ingress", func() {})
|
||||
})
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package create
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
|
||||
"mashibing.com/pkg/mashibing-deployment/test/framework"
|
||||
)
|
||||
|
||||
// 真正的测试函数
|
||||
|
||||
// 测试创建Nodeport模式
|
||||
func CreateNodeportMsbDeployment(ctx *framework.TestContext, f *framework.Framework) {
|
||||
Context("Create msbdeployment mod nodeport", func() {
|
||||
It("Should be create mode nodeport success", func() {})
|
||||
It("Should be exist msbdeployment", func() {})
|
||||
It("Should be exist deployment", func() {})
|
||||
It("Should be exist service", func() {})
|
||||
It("Should not be exist ingress", func() {})
|
||||
})
|
||||
|
||||
Context("Delete msbdeployment mod nodeport", func() {
|
||||
It("Should be delete mod nodeport success", func() {})
|
||||
It("Should not be exist msbdeployment", func() {})
|
||||
It("Should not be exist deployment", func() {})
|
||||
It("Should not be exist service", func() {})
|
||||
It("Should not be exist ingress", func() {})
|
||||
})
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
apiVersion: apps.mashibing.com/v1
|
||||
kind: MsbDeployment
|
||||
metadata:
|
||||
name: create-ingress
|
||||
spec:
|
||||
image: nginx
|
||||
port: 80
|
||||
replicas: 2
|
||||
expose:
|
||||
mode: ingress
|
||||
ingressDomain: www.mashingbing-test.com
|
@ -0,0 +1,11 @@
|
||||
apiVersion: apps.mashibing.com/v1
|
||||
kind: MsbDeployment
|
||||
metadata:
|
||||
name: create-nodeport
|
||||
spec:
|
||||
image: nginx
|
||||
port: 80
|
||||
replicas: 2
|
||||
expose:
|
||||
mode: nodeport
|
||||
nodePort: 30000
|
@ -0,0 +1,9 @@
|
||||
//go:build e2e
|
||||
// +build e2e
|
||||
|
||||
package e2e
|
||||
|
||||
import "mashibing.com/pkg/mashibing-deployment/test/e2e/create"
|
||||
|
||||
var _ = fmw.Describe("Create msbdeployment mod ingress", create.CreateIngressMsbDeployment)
|
||||
var _ = fmw.Describe("Create msbdeployment mod nodeport", create.CreateNodeportMsbDeployment)
|
@ -1,2 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite name="e2e" tests="0" failures="0" errors="0" time="53.339"></testsuite>
|
||||
<testsuite name="e2e" tests="44" failures="0" errors="0" time="88.641">
|
||||
<testcase name="Create msbdeployment mod ingress Create msbdeployment mod ingress Should be create mod ingress success" classname="e2e" time="1.022819158"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Create msbdeployment mod ingress Should be exist msbdeployment" classname="e2e" time="0.011042164"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Create msbdeployment mod ingress Should be exist deployment" classname="e2e" time="0.010476651"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Create msbdeployment mod ingress Should be exist service" classname="e2e" time="0.011884409"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Create msbdeployment mod ingress Should be exist ingress" classname="e2e" time="0.007711314"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Delete msbdeployment mod ingress Should be delete mod ingress success" classname="e2e" time="0.159769005"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Delete msbdeployment mod ingress Should not be exist msbdeployment" classname="e2e" time="0.406098839"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Delete msbdeployment mod ingress Should not be exist deployment" classname="e2e" time="0.406216596"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Delete msbdeployment mod ingress Should not be exist service" classname="e2e" time="0.386941655"></testcase>
|
||||
<testcase name="Create msbdeployment mod ingress Delete msbdeployment mod ingress Should not be exist ingress" classname="e2e" time="0.400914807"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Update msbdeployment mod ingress to nodeport Should be create mod ingress success" classname="e2e" time="0.398575828"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Update msbdeployment mod ingress to nodeport Should be exist msbdeployment" classname="e2e" time="0.40035368"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Update msbdeployment mod ingress to nodeport Should be exist deployment" classname="e2e" time="0.402275948"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Update msbdeployment mod ingress to nodeport Should be exist service" classname="e2e" time="0.397884956"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Update msbdeployment mod ingress to nodeport Should be exist ingress" classname="e2e" time="0.400241593"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Update msbdeployment mod ingress to nodeport Should be update to nodeport success" classname="e2e" time="0.400317655"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Update msbdeployment mod ingress to nodeport Should not be exist ingress" classname="e2e" time="0.400142585"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Delete msbdeployment i2n Should be delete success" classname="e2e" time="0.404196039"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Delete msbdeployment i2n Should not be exist msbdeployment" classname="e2e" time="0.394759408"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Delete msbdeployment i2n Should not be exist deployment" classname="e2e" time="0.400598306"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Delete msbdeployment i2n Should not be exist service" classname="e2e" time="0.399921651"></testcase>
|
||||
<testcase name="Update msbdeployment mod ingress to Nodeport Delete msbdeployment i2n Should not be exist ingress" classname="e2e" time="0.399307785"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Update msbdeployment mod nodeport to ingress Should be create mod nodeport success" classname="e2e" time="0.400627036"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Update msbdeployment mod nodeport to ingress Should be exist msbdeployment" classname="e2e" time="0.399831122"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Update msbdeployment mod nodeport to ingress Should be exist deployment" classname="e2e" time="0.399952299"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Update msbdeployment mod nodeport to ingress Should be exist service" classname="e2e" time="0.3998821"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Update msbdeployment mod nodeport to ingress Should not be exist ingress" classname="e2e" time="0.40065962"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Update msbdeployment mod nodeport to ingress Should be update to ingress success" classname="e2e" time="0.399780321"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Update msbdeployment mod nodeport to ingress Should be exist ingress" classname="e2e" time="0.399753287"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Delete msbdeployment n2i Should be delete success" classname="e2e" time="0.400256732"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Delete msbdeployment n2i Should not be exist msbdeployment" classname="e2e" time="0.399516085"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Delete msbdeployment n2i Should not be exist deployment" classname="e2e" time="0.400321443"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Delete msbdeployment n2i Should not be exist service" classname="e2e" time="0.39949787"></testcase>
|
||||
<testcase name="Update msbdeployment mod nodeport to Ingress Delete msbdeployment n2i Should not be exist ingress" classname="e2e" time="0.399721876"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Create msbdeployment mod nodeport Should be create mode nodeport success" classname="e2e" time="0.400345032"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Create msbdeployment mod nodeport Should be exist msbdeployment" classname="e2e" time="0.399825314"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Create msbdeployment mod nodeport Should be exist deployment" classname="e2e" time="0.399686453"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Create msbdeployment mod nodeport Should be exist service" classname="e2e" time="0.400756069"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Create msbdeployment mod nodeport Should not be exist ingress" classname="e2e" time="0.4001103"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Delete msbdeployment mod nodeport Should be delete mod nodeport success" classname="e2e" time="0.398722227"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Delete msbdeployment mod nodeport Should not be exist msbdeployment" classname="e2e" time="0.401853646"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Delete msbdeployment mod nodeport Should not be exist deployment" classname="e2e" time="0.403237009"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Delete msbdeployment mod nodeport Should not be exist service" classname="e2e" time="0.398816187"></testcase>
|
||||
<testcase name="Create msbdeployment mod nodeport Delete msbdeployment mod nodeport Should not be exist ingress" classname="e2e" time="0.397479371"></testcase>
|
||||
</testsuite>
|
@ -0,0 +1,11 @@
|
||||
apiVersion: apps.mashibing.com/v1
|
||||
kind: MsbDeployment
|
||||
metadata:
|
||||
name: update-ingress
|
||||
spec:
|
||||
image: nginx
|
||||
port: 80
|
||||
replicas: 2
|
||||
expose:
|
||||
mode: nodeport
|
||||
nodePort: 30000
|
@ -0,0 +1,11 @@
|
||||
apiVersion: apps.mashibing.com/v1
|
||||
kind: MsbDeployment
|
||||
metadata:
|
||||
name: update-ingress
|
||||
spec:
|
||||
image: nginx
|
||||
port: 80
|
||||
replicas: 2
|
||||
expose:
|
||||
mode: ingress
|
||||
ingressDomain: www.mashingbing-test.com
|
@ -0,0 +1,11 @@
|
||||
apiVersion: apps.mashibing.com/v1
|
||||
kind: MsbDeployment
|
||||
metadata:
|
||||
name: update-nodeport
|
||||
spec:
|
||||
image: nginx
|
||||
port: 80
|
||||
replicas: 2
|
||||
expose:
|
||||
mode: ingress
|
||||
ingressDomain: www.mashingbing-test.com
|
@ -0,0 +1,11 @@
|
||||
apiVersion: apps.mashibing.com/v1
|
||||
kind: MsbDeployment
|
||||
metadata:
|
||||
name: update-nodeport
|
||||
spec:
|
||||
image: nginx
|
||||
port: 80
|
||||
replicas: 2
|
||||
expose:
|
||||
mode: nodeport
|
||||
nodePort: 30000
|
@ -0,0 +1,31 @@
|
||||
package update
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
|
||||
"mashibing.com/pkg/mashibing-deployment/test/framework"
|
||||
)
|
||||
|
||||
// 真正的测试函数
|
||||
|
||||
// 测试从Ingress模式更新为Nodeport模式
|
||||
func UpdateI2NMsbDeployment(ctx *framework.TestContext, f *framework.Framework) {
|
||||
Context("Update msbdeployment mod ingress to nodeport", func() {
|
||||
It("Should be create mod ingress success", func() {})
|
||||
It("Should be exist msbdeployment", func() {})
|
||||
It("Should be exist deployment", func() {})
|
||||
It("Should be exist service", func() {})
|
||||
It("Should be exist ingress", func() {})
|
||||
|
||||
It("Should be update to nodeport success", func() {})
|
||||
It("Should not be exist ingress", func() {})
|
||||
})
|
||||
|
||||
Context("Delete msbdeployment i2n", func() {
|
||||
It("Should be delete success", func() {})
|
||||
It("Should not be exist msbdeployment", func() {})
|
||||
It("Should not be exist deployment", func() {})
|
||||
It("Should not be exist service", func() {})
|
||||
It("Should not be exist ingress", func() {})
|
||||
})
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package update
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
|
||||
"mashibing.com/pkg/mashibing-deployment/test/framework"
|
||||
)
|
||||
|
||||
// 真正的测试函数
|
||||
|
||||
// 测试从Nodeport模式更新为Ingress模式
|
||||
func UpdateN2IMsbDeployment(ctx *framework.TestContext, f *framework.Framework) {
|
||||
Context("Update msbdeployment mod nodeport to ingress", func() {
|
||||
It("Should be create mod nodeport success", func() {})
|
||||
It("Should be exist msbdeployment", func() {})
|
||||
It("Should be exist deployment", func() {})
|
||||
It("Should be exist service", func() {})
|
||||
It("Should not be exist ingress", func() {})
|
||||
|
||||
It("Should be update to ingress success", func() {})
|
||||
It("Should be exist ingress", func() {})
|
||||
})
|
||||
|
||||
Context("Delete msbdeployment n2i", func() {
|
||||
It("Should be delete success", func() {})
|
||||
It("Should not be exist msbdeployment", func() {})
|
||||
It("Should not be exist deployment", func() {})
|
||||
It("Should not be exist service", func() {})
|
||||
It("Should not be exist ingress", func() {})
|
||||
})
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
//go:build e2e
|
||||
// +build e2e
|
||||
|
||||
package e2e
|
||||
|
||||
import "mashibing.com/pkg/mashibing-deployment/test/e2e/update"
|
||||
|
||||
var _ = fmw.Describe("Update msbdeployment mod ingress to Nodeport", update.UpdateI2NMsbDeployment)
|
||||
var _ = fmw.Describe("Update msbdeployment mod nodeport to Ingress", update.UpdateN2IMsbDeployment)
|
Loading…
Reference in new issue