Skip to content

Commit c549348

Browse files
committed
investigate: test passes even without the proper SA permissions
The "reset namespaces" test passes even though the PR which adds the "member" service account the, in theory, required permission to delete namespaces has not been merged. The test does not pass when running the tests locally, and in stage and production the feature does not work without that permission. SANDBOX-1067
1 parent 97cf9ce commit c549348

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/e2e/namespaces_reset_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package e2e
22

33
import (
4+
"context"
45
"net/http"
56
"testing"
67
"time"
@@ -13,6 +14,8 @@ import (
1314
"github.com/google/uuid"
1415
"github.com/stretchr/testify/require"
1516
"github.com/stretchr/testify/suite"
17+
rbacv1 "k8s.io/api/rbac/v1"
18+
"k8s.io/apimachinery/pkg/types"
1619
)
1720

1821
type namespaceResetFeatureIntegrationSuite struct {
@@ -33,6 +36,7 @@ func (s *namespaceResetFeatureIntegrationSuite) SetupSuite() {
3336
// expected.
3437
func (s *namespaceResetFeatureIntegrationSuite) TestResetNamespaces() {
3538
// given
39+
hostAwaitily := s.Host()
3640
memberAwaitily := s.Member1()
3741

3842
// Create a new user signup for the test.
@@ -107,4 +111,14 @@ func (s *namespaceResetFeatureIntegrationSuite) TestResetNamespaces() {
107111

108112
require.NotEqual(s.T(), timestamp, fetchedNamespace.CreationTimestamp.Time, `the namespace "%s" appears to not have been recreated due to having the same creation timestamp as before`, fetchedNamespace.Name)
109113
}
114+
115+
// DELETEME - printing the member service account's cluster role to check
116+
// its permissions.
117+
clusterRole := rbacv1.ClusterRole{}
118+
err = hostAwaitily.Client.Get(context.TODO(), types.NamespacedName{Name: "toolchaincluster-" + memberAwaitily.Namespace}, &clusterRole)
119+
require.NoError(s.T(), err, "unable to obtain the cluster role")
120+
121+
s.T().Logf("ClusterRole: %+v", clusterRole)
122+
123+
require.FailNow(s.T(), "the test succeeded but we are failing to gather information")
110124
}

0 commit comments

Comments
 (0)