Skip to content

Commit

Permalink
additional RBAC test (#985)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
  • Loading branch information
kubevirt-bot authored and awels committed Oct 7, 2019
1 parent 6d9ffb7 commit e1d83df
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions tests/rbac_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tests

import (
"fmt"
"reflect"
"time"

Expand Down Expand Up @@ -58,7 +57,7 @@ var _ = Describe("Aggregated role in-action tests", func() {
f := framework.NewFrameworkOrDie("aggregated-role-tests")

DescribeTable("admin/edit datavolume permission checks", func(user string) {
var client cdiClientset.Interface
var client *cdiClientset.Clientset
var err error

createServiceAccount(f.K8sClient, f.Namespace.Name, user)
Expand Down Expand Up @@ -87,8 +86,28 @@ var _ = Describe("Aggregated role in-action tests", func() {
Expect(err).ToNot(HaveOccurred())
Expect(dvl.Items).To(HaveLen(0))

dv = utils.NewDataVolumeForUpload("upload-test-"+user, "1Gi")
dv, err = client.Cdi().DataVolumes(f.Namespace.Name).Create(dv)
Expect(err).ToNot(HaveOccurred())

var pvc *corev1.PersistentVolumeClaim
Eventually(func() error {
pvc, err = f.K8sClient.CoreV1().PersistentVolumeClaims(f.Namespace.Name).Get(dv.Name, metav1.GetOptions{})
if err != nil {
return err
}
return nil
}, 90*time.Second, 2*time.Second).ShouldNot(HaveOccurred())

found, err := utils.WaitPVCPodStatusRunning(f.K8sClient, pvc)
Expect(err).ToNot(HaveOccurred())
Expect(found).Should(BeTrue())

token, err := utils.RequestUploadToken(client, pvc)
Expect(err).ToNot(HaveOccurred())
Expect(token).ToNot(BeEmpty())

cl, err := client.Cdi().CDIConfigs().List(metav1.ListOptions{})
fmt.Printf("XXX %+v\n", err)
Expect(err).ToNot(HaveOccurred())
Expect(cl.Items).To(HaveLen(1))

Expand Down

0 comments on commit e1d83df

Please sign in to comment.