Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Do not hardcode PVC UUID in backup test #825

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/vmware-tanzu/vm-operator/external/tanzu-topology v0.0.0-00010101000000-000000000000
github.com/vmware-tanzu/vm-operator/pkg/backup/api v0.0.0-00010101000000-000000000000
github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-00010101000000-000000000000
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241212200752-b1027ba34d97
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241213132711-bde6f8c8ae04
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
// * https://github.com/vmware-tanzu/vm-operator/security/dependabot/24
golang.org/x/text v0.21.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ github.com/vmware-tanzu/net-operator-api v0.0.0-20240523152550-862e2c4eb0e0 h1:y
github.com/vmware-tanzu/net-operator-api v0.0.0-20240523152550-862e2c4eb0e0/go.mod h1:w6QJGm3crIA16ZIz1FVQXD2NVeJhOgGXxW05RbVTSTo=
github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112044858-9da8637c1b0d h1:z9lrzKVtNlujduv9BilzPxuge/LE2F0N1ms3TP4JZvw=
github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112044858-9da8637c1b0d/go.mod h1:Q4JzNkNMvjo7pXtlB5/R3oME4Nhah7fAObWgghVmtxk=
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241212200752-b1027ba34d97 h1:cU+/GAgXM2PvaynD0SE/SmQrATKoH1BHYr8aLif0fC4=
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241212200752-b1027ba34d97/go.mod h1:bYwUHpGpisE4AOlDl5eph90T+cjJMIcKx/kaa5v5rQM=
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241213132711-bde6f8c8ae04 h1:f0q34TEWkqjtsENWOEUqp3snpxZtbs0qiBhH5FSgoyU=
github.com/vmware/govmomi v0.47.0-alpha.0.0.20241213132711-bde6f8c8ae04/go.mod h1:bYwUHpGpisE4AOlDl5eph90T+cjJMIcKx/kaa5v5rQM=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
20 changes: 11 additions & 9 deletions pkg/providers/vsphere/virtualmachine/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ func backupTests() {
vcSimVMPath = "DC0_C0_RP0_VM0"
vcSimDiskFileName = "[LocalDS_0] DC0_C0_RP0_VM0/disk1.vmdk"

// TODO(akutz) Do not hard-code this value. Instead use
// QueryVirtualDiskUuid to find it from the file name.
// However, there is a bug in vC Sim's implementation of
// this function, so hard-code for now.
vcSimDiskUUID = "60c03576-c448-58e1-a47a-1165dd2c4120"
// dummy backup versions at timestamp t1, t2, t3.
vT1 = "1001"
vT2 = "1002"
Expand All @@ -52,10 +47,11 @@ func backupTests() {
)

var (
ctx *builder.TestContextForVCSim
vcVM *object.VirtualMachine
vmCtx pkgctx.VirtualMachineContext
testConfig builder.VCSimTestConfig
ctx *builder.TestContextForVCSim
vcVM *object.VirtualMachine
vmCtx pkgctx.VirtualMachineContext
testConfig builder.VCSimTestConfig
vcSimDiskUUID string
)

BeforeEach(func() {
Expand All @@ -64,6 +60,12 @@ func backupTests() {

JustBeforeEach(func() {
ctx = suite.NewTestContextForVCSim(testConfig)

dskMgr := object.NewVirtualDiskManager(ctx.VCClient.Client)
var err error
vcSimDiskUUID, err = dskMgr.QueryVirtualDiskUuid(ctx, vcSimDiskFileName, ctx.Datacenter)
Expect(err).ToNot(HaveOccurred())
Expect(vcSimDiskUUID).ToNot(BeZero())
})

AfterEach(func() {
Expand Down
Loading