Skip to content

Commit

Permalink
Fix assigning of policies to WCP namespace in case of policy driven v…
Browse files Browse the repository at this point in the history
…olume provisioing testcases
  • Loading branch information
Aishwarya-Hebbar committed Jan 27, 2025
1 parent 37f0ecc commit 6c318f9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
15 changes: 14 additions & 1 deletion tests/e2e/policy_driven_vol_allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,20 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation
}

if supervisorCluster {
assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit)
//vcAddress := e2eVSphere.Config.Global.VCenterHostname + ":" + sshdPort
vcRestSessionId := createVcSession4RestApis(ctx)

//storageClassName = strings.ReplaceAll(storagePolicyName, "_", "-") // since this is a wcp setup

eztstoragePolicyId := e2eVSphere.GetSpbmPolicyID(policyNames[0])
lztstoragePolicyId := e2eVSphere.GetSpbmPolicyID(policyNames[1])
thinstoragePolicyId := e2eVSphere.GetSpbmPolicyID(policyNames[2])

framework.Logf("Create a WCP namespace for the test")

namespace = createTestWcpNs(
vcRestSessionId, eztstoragePolicyId, lztstoragePolicyId, thinstoragePolicyId, "", "", getSvcId(vcRestSessionId))
//assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit)
} else if guestCluster {
_, svNamespace := getSvcClientAndNamespace()
assignPolicyToWcpNamespace(client, ctx, svNamespace, policyNames, resourceQuotaLimit)
Expand Down
10 changes: 8 additions & 2 deletions tests/e2e/vmservice_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type subscribedContentLibBasic struct {

// createTestWcpNs create a wcp namespace with given storage policy, vm class and content lib via REST API
func createTestWcpNs(
vcRestSessionId string, storagePolicyId string, vmClass string, contentLibId string,
vcRestSessionId string, eztstoragePolicyId string, lztstoragePolicyId string, thinstoragePolicyId string, vmClass string, contentLibId string,
supervisorId string) string {

vcIp := e2eVSphere.Config.Global.VCenterHostname
Expand All @@ -74,6 +74,12 @@ func createTestWcpNs(
"namespace": "%s",
"storage_specs": [ {
"policy": "%s"
},
{
"policy": "%s"
},
{
"policy": "%s"
} ],
"vm_service_spec": {
"vm_classes": [
Expand All @@ -84,7 +90,7 @@ func createTestWcpNs(
]
},
"supervisor": "%s"
}`, namespace, storagePolicyId, vmClass, contentLibId, supervisorId)
}`, namespace, eztstoragePolicyId, lztstoragePolicyId, thinstoragePolicyId, vmClass, contentLibId, supervisorId)

_, statusCode := invokeVCRestAPIPostRequest(vcRestSessionId, nsCreationUrl, reqBody)
gomega.Expect(statusCode).Should(gomega.BeNumerically("==", 204))
Expand Down

0 comments on commit 6c318f9

Please sign in to comment.