github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/topgun/k8s/mainteam_role_test.go (about) 1 package k8s_test 2 3 import ( 4 . "github.com/pf-qiu/concourse/v6/topgun" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 ) 8 9 var _ = Describe("Main team role config", func() { 10 var ( 11 atc Endpoint 12 13 helmDeployTestFlags []string 14 username, password = "test-viewer", "test-viewer" 15 ) 16 17 BeforeEach(func() { 18 setReleaseNameAndNamespace("mt") 19 Run(nil, "kubectl", "create", "namespace", namespace) 20 }) 21 22 JustBeforeEach(func() { 23 deployConcourseChart(releaseName, helmDeployTestFlags...) 24 25 waitAllPodsInNamespaceToBeReady(namespace) 26 27 atc = endpointFactory.NewServiceEndpoint( 28 namespace, 29 releaseName+"-web", 30 "8080", 31 ) 32 33 fly.Login(username, password, "http://"+atc.Address()) 34 35 }) 36 37 AfterEach(func() { 38 atc.Close() 39 cleanupReleases() 40 }) 41 42 Context("Adding team role config yaml to web", func() { 43 BeforeEach(func() { 44 helmDeployTestFlags = []string{ 45 `--set=worker.enabled=false`, 46 `--set=concourse.web.auth.mainTeam.config= 47 roles: 48 - name: viewer 49 local: 50 users: [ "test-viewer" ] 51 `, 52 `--set=secrets.localUsers=test-viewer:test-viewer`, 53 } 54 }) 55 56 It("returns the correct user role", func() { 57 userRole := fly.GetUserRole("main") 58 Expect(userRole).To(HaveLen(1)) 59 Expect(userRole[0]).To(Equal("viewer")) 60 }) 61 }) 62 63 })