feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
@@ -1,18 +1,7 @@
|
||||
/*
|
||||
Copyright 2019 The KubeSphere Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
* Please refer to the LICENSE file in the root directory of the project.
|
||||
* https://github.com/kubesphere/kubesphere/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package workspace
|
||||
|
||||
@@ -20,12 +9,11 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
tenantv1alpha1 "kubesphere.io/api/tenant/v1alpha1"
|
||||
tenantv1beta1 "kubesphere.io/api/tenant/v1beta1"
|
||||
)
|
||||
|
||||
var _ = Describe("Workspace", func() {
|
||||
@@ -40,7 +28,7 @@ var _ = Describe("Workspace", func() {
|
||||
Context("Workspace Controller", func() {
|
||||
It("Should create successfully", func() {
|
||||
|
||||
workspace := &tenantv1alpha1.Workspace{
|
||||
workspace := &tenantv1beta1.Workspace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "workspace-test",
|
||||
},
|
||||
@@ -51,13 +39,13 @@ var _ = Describe("Workspace", func() {
|
||||
|
||||
By("Expecting to create workspace successfully")
|
||||
Eventually(func() bool {
|
||||
f := &tenantv1alpha1.Workspace{}
|
||||
k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, f)
|
||||
f := &tenantv1beta1.Workspace{}
|
||||
_ = k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, f)
|
||||
return len(f.Finalizers) > 0
|
||||
}, timeout, interval).Should(BeTrue())
|
||||
|
||||
// Update
|
||||
updated := &tenantv1alpha1.Workspace{}
|
||||
updated := &tenantv1beta1.Workspace{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, updated)).Should(Succeed())
|
||||
updated.Spec.Manager = "admin"
|
||||
Expect(k8sClient.Update(context.Background(), updated)).Should(Succeed())
|
||||
@@ -65,21 +53,21 @@ var _ = Describe("Workspace", func() {
|
||||
// List workspace role bindings
|
||||
By("Expecting to update workspace successfully")
|
||||
Eventually(func() bool {
|
||||
k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, workspace)
|
||||
_ = k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, workspace)
|
||||
return workspace.Spec.Manager == "admin"
|
||||
}, timeout, interval).Should(BeTrue())
|
||||
|
||||
// Delete
|
||||
By("Expecting to delete workspace successfully")
|
||||
Eventually(func() error {
|
||||
f := &tenantv1alpha1.Workspace{}
|
||||
k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, f)
|
||||
f := &tenantv1beta1.Workspace{}
|
||||
_ = k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, f)
|
||||
return k8sClient.Delete(context.Background(), f)
|
||||
}, timeout, interval).Should(Succeed())
|
||||
|
||||
By("Expecting to delete workspace finish")
|
||||
Eventually(func() error {
|
||||
f := &tenantv1alpha1.Workspace{}
|
||||
f := &tenantv1beta1.Workspace{}
|
||||
return k8sClient.Get(context.Background(), types.NamespacedName{Name: workspace.Name}, f)
|
||||
}, timeout, interval).ShouldNot(Succeed())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user