Skip to content

Commit

Permalink
Merge pull request rancher#47054 from lscalabrini01/qa_issue_1538-v2.9
Browse files Browse the repository at this point in the history
<v2.9> Fix Missing Cluster ID Qase test
  • Loading branch information
lscalabrini01 authored Sep 11, 2024
2 parents aa0df7e + ad1b8c0 commit fcf4d12
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/v2/validation/rbac/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"testing"

"github.com/rancher/norman/types"
"github.com/rancher/rancher/tests/v2/actions/projects"
"github.com/rancher/rancher/tests/v2/actions/rbac"
"github.com/rancher/shepherd/clients/rancher"
Expand Down Expand Up @@ -47,12 +48,21 @@ func (rb *RBTestSuite) SetupSuite() {
rb.cluster, err = rb.client.Management.Cluster.ByID(clusterID)
require.NoError(rb.T(), err)

log.Info("Getting cluster names")
clusterList, err := client.Management.Cluster.List(&types.ListOpts{})
require.NoError(rb.T(), err)

for _, cluster := range clusterList.Data {
log.Infof("Cluster name %s", cluster.Name)
}
}

func (rb *RBTestSuite) sequentialTestRBAC(role rbac.Role, member string, user *management.User) {
standardClient, err := rb.client.AsUser(user)
require.NoError(rb.T(), err)

log.Infof("Cluster ID %s", rb.cluster.ID)

adminProject, err := rb.client.Management.Project.Create(projects.NewProjectConfig(rb.cluster.ID))
require.NoError(rb.T(), err)

Expand All @@ -72,6 +82,8 @@ func (rb *RBTestSuite) sequentialTestRBAC(role rbac.Role, member string, user *m
additionalUser, err := users.CreateUserWithRole(rb.client, users.UserConfig(), rbac.StandardUser.String())
require.NoError(rb.T(), err)

log.Infof("Cluster ID %s", rb.cluster.ID)

rb.Run("Validating Global Role Binding is created for "+role.String(), func() {
rbac.VerifyGlobalRoleBindingsForUser(rb.T(), user, rb.client)
})
Expand Down
17 changes: 16 additions & 1 deletion tests/v2/validation/workloads/workload_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//go:build (validation || infra.any || cluster.any || sanity) && !stress
//go:build (validation || infra.any || cluster.any || sanity) && !stress && !extended

package workloads

import (
"testing"

"github.com/rancher/norman/types"
projectsapi "github.com/rancher/rancher/tests/v2/actions/projects"
"github.com/rancher/rancher/tests/v2/actions/workloads/cronjob"
"github.com/rancher/rancher/tests/v2/actions/workloads/daemonset"
Expand Down Expand Up @@ -54,12 +55,21 @@ func (w *WorkloadTestSuite) SetupSuite() {

w.cluster, err = w.client.Management.Cluster.ByID(clusterID)
require.NoError(w.T(), err)

log.Info("Getting cluster names")
clusterList, err := client.Management.Cluster.List(&types.ListOpts{})
require.NoError(w.T(), err)

for _, cluster := range clusterList.Data {
log.Infof("Cluster name %s", cluster.Name)
}
}

func (w *WorkloadTestSuite) TestWorkloadDeployment() {
subSession := w.session.NewSession()
defer subSession.Cleanup()

log.Infof("Cluster ID %s", w.cluster.ID)
_, namespace, err := projectsapi.CreateProjectAndNamespace(w.client, w.cluster.ID)
require.NoError(w.T(), err)

Expand All @@ -71,6 +81,7 @@ func (w *WorkloadTestSuite) TestWorkloadSideKick() {
subSession := w.session.NewSession()
defer subSession.Cleanup()

log.Infof("Cluster ID %s", w.cluster.ID)
_, namespace, err := projectsapi.CreateProjectAndNamespace(w.client, w.cluster.ID)
require.NoError(w.T(), err)

Expand Down Expand Up @@ -109,6 +120,7 @@ func (w *WorkloadTestSuite) TestWorkloadDaemonSet() {
subSession := w.session.NewSession()
defer subSession.Cleanup()

log.Infof("Cluster ID %s", w.cluster.ID)
_, namespace, err := projectsapi.CreateProjectAndNamespace(w.client, w.cluster.ID)
require.NoError(w.T(), err)

Expand All @@ -125,6 +137,7 @@ func (w *WorkloadTestSuite) TestWorkloadCronjob() {
subSession := w.session.NewSession()
defer subSession.Cleanup()

log.Infof("Cluster ID %s", w.cluster.ID)
_, namespace, err := projectsapi.CreateProjectAndNamespace(w.client, w.cluster.ID)
require.NoError(w.T(), err)

Expand Down Expand Up @@ -160,6 +173,7 @@ func (w *WorkloadTestSuite) TestWorkloadStatefulset() {
subSession := w.session.NewSession()
defer subSession.Cleanup()

log.Infof("Cluster ID %s", w.cluster.ID)
_, namespace, err := projectsapi.CreateProjectAndNamespace(w.client, w.cluster.ID)
require.NoError(w.T(), err)

Expand Down Expand Up @@ -197,6 +211,7 @@ func (w *WorkloadTestSuite) TestWorkloadUpgrade() {
subSession := w.session.NewSession()
defer subSession.Cleanup()

log.Infof("Cluster ID %s", w.cluster.ID)
_, namespace, err := projectsapi.CreateProjectAndNamespace(w.client, w.cluster.ID)
require.NoError(w.T(), err)

Expand Down

0 comments on commit fcf4d12

Please sign in to comment.