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
59
test/e2e/users.go
Normal file
59
test/e2e/users.go
Normal file
@@ -0,0 +1,59 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
iamv1beta1 "kubesphere.io/api/iam/v1beta1"
|
||||
"kubesphere.io/client-go/rest"
|
||||
|
||||
"kubesphere.io/kubesphere/test/e2e/framework"
|
||||
)
|
||||
|
||||
var _ = Describe("User", func() {
|
||||
|
||||
f := framework.NewKubeSphereFramework()
|
||||
|
||||
userName := "test"
|
||||
var client *rest.RESTClient
|
||||
|
||||
BeforeEach(func() {
|
||||
client = f.RestClient()
|
||||
})
|
||||
|
||||
It("Create user", func() {
|
||||
By(fmt.Sprintf("Expecting to user %s does not exists", userName))
|
||||
|
||||
user := &iamv1beta1.User{}
|
||||
err := client.Get().
|
||||
Prefix("/apis").
|
||||
Group("iam.kubesphere.io").
|
||||
Version("v1alpha2").
|
||||
Resource("users").
|
||||
Name(userName).
|
||||
Do(context.Background()).
|
||||
Into(user)
|
||||
|
||||
Expect(err).ShouldNot(BeNil())
|
||||
|
||||
user = &iamv1beta1.User{
|
||||
ObjectMeta: v1.ObjectMeta{Name: userName},
|
||||
}
|
||||
err = client.Post().
|
||||
Prefix("/apis").
|
||||
Group("iam.kubesphere.io").
|
||||
Version("v1alpha2").
|
||||
Resource("users").
|
||||
Body(user).
|
||||
Do(context.Background()).
|
||||
Into(user)
|
||||
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(user.ResourceVersion).ShouldNot(BeEmpty())
|
||||
|
||||
framework.Logf("User created successfully")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user