Exercise Get of serviceaccount in e2e

This commit is contained in:
Jordan Liggitt 2022-03-16 20:24:50 -04:00
parent 2b1b849d6a
commit 654dc8686b

View File

@ -646,9 +646,13 @@ var _ = SIGDescribe("ServiceAccounts", func() {
Labels: testServiceAccountStaticLabels,
},
}
_, err := f.ClientSet.CoreV1().ServiceAccounts(testNamespaceName).Create(context.TODO(), &testServiceAccount, metav1.CreateOptions{})
createdServiceAccount, err := f.ClientSet.CoreV1().ServiceAccounts(testNamespaceName).Create(context.TODO(), &testServiceAccount, metav1.CreateOptions{})
framework.ExpectNoError(err, "failed to create a ServiceAccount")
getServiceAccount, err := f.ClientSet.CoreV1().ServiceAccounts(testNamespaceName).Get(context.TODO(), testServiceAccountName, metav1.GetOptions{})
framework.ExpectNoError(err, "failed to fetch the created ServiceAccount")
framework.ExpectEqual(createdServiceAccount.UID, getServiceAccount.UID)
ginkgo.By("watching for the ServiceAccount to be added")
resourceWatchTimeoutSeconds := int64(180)
resourceWatch, err := f.ClientSet.CoreV1().ServiceAccounts(testNamespaceName).Watch(context.TODO(), metav1.ListOptions{LabelSelector: testServiceAccountStaticLabelsFlat, TimeoutSeconds: &resourceWatchTimeoutSeconds})