Skip to content

Commit 09548ba

Browse files
committed
Support Windows E2E.
* Please notice only Kibishii workload support Windows test, because the other work loads use busybox image, and not support Windows. * Refactor CreateFileToPod to support Windows. * Add skip logic for migration test if the version is under 1.16. * Add main in semver check. Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
1 parent 4c23f66 commit 09548ba

20 files changed

Lines changed: 375 additions & 103 deletions

File tree

hack/build-image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5
3434

3535
# get goimports (the revision is pinned so we don't indiscriminately update, but the particular commit
3636
# is not important)
37-
RUN go install golang.org/x/tools/cmd/goimports@11e9d9cc0042e6bd10337d4d2c3e5d9295508e7d
37+
RUN go install golang.org/x/tools/cmd/goimports@v0.33.0
3838

3939
# get protoc compiler and golang plugin
4040
WORKDIR /root

test/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ VELERO_SERVER_DEBUG_MODE ?= false
119119

120120
ITEM_BLOCK_WORKER_COUNT ?= 1
121121

122+
WORKER_OS ?= linux
123+
122124
# Parameters to run migration tests along with all other E2E tests, and both of them should
123125
# be provided or left them all empty to skip migration tests with no influence to other
124126
# E2E tests.
@@ -221,7 +223,8 @@ run-e2e: ginkgo
221223
--standby-cls-service-account-name=$(STANDBY_CLS_SERVICE_ACCOUNT_NAME) \
222224
--kibishii-directory=$(KIBISHII_DIRECTORY) \
223225
--disable-informer-cache=$(DISABLE_INFORMER_CACHE) \
224-
--image-registry-proxy=$(IMAGE_REGISTRY_PROXY)
226+
--image-registry-proxy=$(IMAGE_REGISTRY_PROXY) \
227+
--worker-os=$(WORKER_OS)
225228

226229
.PHONY: run-perf
227230
run-perf: ginkgo

test/e2e/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ These configuration parameters are expected as values to the following command l
7979
1. `--debug-velero-pod-restart`: A switch for debugging velero pod restart.
8080
1. `--fail-fast`: A switch for for failing fast on meeting error.
8181
1. `--has-vsphere-plugin`: A switch to indicate whether the Velero vSphere plugin is installed for vSphere environment.
82+
1. `--worker-os`: A switch to indicate the workload should be ran on windows or linux OS.
8283

8384
These configurations or parameters are used to generate install options for Velero for each test suite.
8485

@@ -131,6 +132,7 @@ Below is a mapping between `make` variables to E2E configuration flags.
131132
1. `DEBUG_VELERO_POD_RESTART`: `-debug-velero-pod-restart`. Optional.
132133
1. `FAIL_FAST`: `--fail-fast`. Optional.
133134
1. `HAS_VSPHERE_PLUGIN`: `--has-vsphere-plugin`. Optional.
135+
1. `WORKER_OS`: `--worker-os`. Optional.
134136

135137

136138

test/e2e/backup/backup.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,15 @@ func BackupRestoreTest(backupRestoreTestConfig BackupRestoreTestConfig) {
140140
veleroCfg.ProvideSnapshotsVolumeParam = provideSnapshotVolumesParmInBackup
141141

142142
// Set DefaultVolumesToFsBackup to false since DefaultVolumesToFsBackup was set to true during installation
143-
Expect(RunKibishiiTests(veleroCfg, backupName, restoreName, "", kibishiiNamespace, useVolumeSnapshots, false)).To(Succeed(),
143+
Expect(RunKibishiiTests(
144+
veleroCfg,
145+
backupName,
146+
restoreName,
147+
"",
148+
kibishiiNamespace,
149+
useVolumeSnapshots,
150+
false,
151+
)).To(Succeed(),
144152
"Failed to successfully backup and restore Kibishii namespace")
145153
})
146154

@@ -212,7 +220,17 @@ func BackupRestoreTest(backupRestoreTestConfig BackupRestoreTestConfig) {
212220
}
213221
veleroCfg.ProvideSnapshotsVolumeParam = !provideSnapshotVolumesParmInBackup
214222
workloadNS := kibishiiNamespace + bsl
215-
Expect(RunKibishiiTests(veleroCfg, backupName, restoreName, bsl, workloadNS, useVolumeSnapshots, !useVolumeSnapshots)).To(Succeed(),
223+
Expect(
224+
RunKibishiiTests(
225+
veleroCfg,
226+
backupName,
227+
restoreName,
228+
bsl,
229+
workloadNS,
230+
useVolumeSnapshots,
231+
!useVolumeSnapshots,
232+
),
233+
).To(Succeed(),
216234
"Failed to successfully backup and restore Kibishii namespace using BSL %s", bsl)
217235
}
218236
})

test/e2e/backups/deletion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func runBackupDeletionTests(client TestClient, veleroCfg VeleroConfig, backupLoc
125125
kibishiiDirectory,
126126
DefaultKibishiiData,
127127
veleroCfg.ImageRegistryProxy,
128+
veleroCfg.WorkerOS,
128129
); err != nil {
129130
return errors.Wrapf(err, "Failed to install and prepare data for kibishii %s", ns)
130131
}

test/e2e/backups/ttl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func TTLTest() {
110110
veleroCfg.KibishiiDirectory,
111111
DefaultKibishiiData,
112112
veleroCfg.ImageRegistryProxy,
113+
veleroCfg.WorkerOS,
113114
)).To(Succeed())
114115
})
115116

test/e2e/basic/backup-volume-info/base.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,16 @@ func (v *BackupVolumeInfo) CreateResources() error {
138138
// Hitting issue https://github.com/vmware-tanzu/velero/issues/7388
139139
// So populate data only to some of pods, leave other pods empty to verify empty PV datamover
140140
if i%2 == 0 {
141-
Expect(CreateFileToPod(v.Ctx, createNSName, pod.Name, DefaultContainerName, vols[i].Name,
142-
fmt.Sprintf("file-%s", pod.Name), CreateFileContent(createNSName, pod.Name, vols[i].Name))).To(Succeed())
141+
Expect(CreateFileToPod(
142+
v.Ctx,
143+
createNSName,
144+
pod.Name,
145+
DefaultContainerName,
146+
vols[i].Name,
147+
fmt.Sprintf("file-%s", pod.Name),
148+
CreateFileContent(createNSName, pod.Name, vols[i].Name),
149+
WorkerOSLinux,
150+
)).To(Succeed())
143151
}
144152
}
145153
}

test/e2e/basic/namespace-mapping.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func (n *NamespaceMapping) CreateResources() error {
101101
n.VeleroCfg.KibishiiDirectory,
102102
n.kibishiiData,
103103
n.VeleroCfg.ImageRegistryProxy,
104+
n.VeleroCfg.WorkerOS,
104105
)).To(Succeed())
105106
})
106107
}
@@ -111,8 +112,14 @@ func (n *NamespaceMapping) Verify() error {
111112
for index, ns := range n.MappedNamespaceList {
112113
n.kibishiiData.Levels = len(*n.NSIncluded) + index
113114
By(fmt.Sprintf("Verify workload %s after restore ", ns), func() {
114-
Expect(KibishiiVerifyAfterRestore(n.Client, ns,
115-
n.Ctx, n.kibishiiData, "")).To(Succeed(), "Fail to verify workload after restore")
115+
Expect(KibishiiVerifyAfterRestore(
116+
n.Client,
117+
ns,
118+
n.Ctx,
119+
n.kibishiiData,
120+
"",
121+
n.VeleroCfg.WorkerOS,
122+
)).To(Succeed(), "Fail to verify workload after restore")
116123
})
117124
}
118125
for _, ns := range *n.NSIncluded {

test/e2e/bsl-mgmt/deletion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func BslDeletionTest(useVolumeSnapshots bool) {
162162
veleroCfg.KibishiiDirectory,
163163
DefaultKibishiiData,
164164
veleroCfg.ImageRegistryProxy,
165+
veleroCfg.WorkerOS,
165166
)).To(Succeed())
166167
})
167168

test/e2e/e2e_suite_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,12 @@ func init() {
356356
"",
357357
"The image registry proxy, e.g. when the DockerHub access limitation is reached, can use available proxy to replace. Default is nil.",
358358
)
359+
flag.StringVar(
360+
&test.VeleroCfg.WorkerOS,
361+
"worker-os",
362+
"linux",
363+
"test k8s worker node OS version, should be either linux or windows.",
364+
)
359365
}
360366

361367
// Add label [SkipVanillaZfs]:
@@ -621,12 +627,12 @@ var _ = Describe(
621627

622628
var _ = Describe(
623629
"Backup resources should follow the specific order in schedule",
624-
Label("PVBackup", "OptIn"),
630+
Label("PVBackup", "OptIn", "Restic"),
625631
OptInPVBackupTest,
626632
)
627633
var _ = Describe(
628634
"Backup resources should follow the specific order in schedule",
629-
Label("PVBackup", "OptOut"),
635+
Label("PVBackup", "OptOut", "Restic"),
630636
OptOutPVBackupTest,
631637
)
632638

0 commit comments

Comments
 (0)