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
@@ -3,60 +3,30 @@ package e2e
|
||||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/onsi/ginkgo" //nolint:stylecheck
|
||||
. "github.com/onsi/gomega" //nolint:stylecheck
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"kubesphere.io/client-go/client"
|
||||
"kubesphere.io/client-go/rest"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2" //nolint:stylecheck
|
||||
. "github.com/onsi/gomega" //nolint:stylecheck
|
||||
|
||||
"kubesphere.io/kubesphere/test/e2e/framework"
|
||||
"kubesphere.io/kubesphere/test/e2e/framework/workspace"
|
||||
)
|
||||
|
||||
var _ = Describe("API Test", func() {
|
||||
|
||||
f := framework.NewKubeSphereFramework("worksspace")
|
||||
var gclient client.Client
|
||||
f := framework.NewKubeSphereFramework()
|
||||
var client *rest.RESTClient
|
||||
|
||||
BeforeEach(func() {
|
||||
gclient = f.GenericClient("worksspace")
|
||||
client = f.RestClient()
|
||||
})
|
||||
|
||||
It("Should list Kubernetes objects through ks proxy", func() {
|
||||
results := &corev1.NamespaceList{}
|
||||
It("Should retrieve KubeSphere API version", func() {
|
||||
result := client.Get().AbsPath("/version").Do(context.Background())
|
||||
Expect(result.Error()).Should(BeNil())
|
||||
|
||||
Expect(gclient.List(context.TODO(), results)).Should(Succeed())
|
||||
data, err := result.Raw()
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
if len(results.Items) < 1 {
|
||||
framework.Failf("Test Failed caused no Cluster role was found")
|
||||
}
|
||||
framework.Logf("Response is %v", results)
|
||||
})
|
||||
|
||||
It("Should get Kubernetes objects through ks proxy", func() {
|
||||
deploy := &appsv1.Deployment{}
|
||||
|
||||
Expect(gclient.Get(context.TODO(), client.ObjectKey{Namespace: "kubesphere-system", Name: "ks-apiserver"}, deploy)).Should(Succeed())
|
||||
Expect(deploy.Name).To(Equal("ks-apiserver"))
|
||||
})
|
||||
|
||||
It("Should list Kubernetes objects through ksapi", func() {
|
||||
results := &corev1.NamespaceList{}
|
||||
|
||||
opts := workspace.URLOptions
|
||||
|
||||
err := gclient.List(context.TODO(), results, &opts)
|
||||
framework.ExpectNoError(err)
|
||||
framework.Logf("Response is %v", results)
|
||||
})
|
||||
|
||||
It("Should list Kubernetes objects through ksapi by workspaces", func() {
|
||||
results := &corev1.NamespaceList{}
|
||||
|
||||
opts := workspace.URLOptions
|
||||
|
||||
err := gclient.List(context.TODO(), results, &opts, &client.WorkspaceOptions{Name: "kubesphere-system"})
|
||||
framework.ExpectNoError(err)
|
||||
framework.Logf("Response is %v", results)
|
||||
framework.Logf("Response is %v", string(data))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user