Skip to content

Commit cb766e8

Browse files
committed
fix
1 parent 05d1a71 commit cb766e8

File tree

2 files changed

+8
-42
lines changed

2 files changed

+8
-42
lines changed

test/e2e/internal/tests/parallelarchive/fixtures.go

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func createParallelArchiveTestResources(namespace string, maxParallel int) paral
4747
resources.ObjectStoreResources = objectstore.NewMinioObjectStoreResources(namespace, minio)
4848
resources.Archive = objectstore.NewMinioArchive(namespace, archiveName, minio, maxParallel)
4949
resources.Cluster = createClusterWithArchive(namespace, clusterName, archiveName)
50-
resources.Backup = newPluginBackup(namespace)
50+
resources.Backup = createPluginBackup(namespace)
5151

5252
return resources
5353
}
@@ -88,32 +88,9 @@ func createClusterWithArchive(namespace, clusterName, archiveName string) *cloud
8888
return cluster
8989
}
9090

91-
// createInitialBackup creates a backup resource to initialize the pgBackRest stanza
92-
func createInitialBackup(namespace, clusterName string) *cloudnativepgv1.Backup {
93-
return &cloudnativepgv1.Backup{
94-
TypeMeta: metav1.TypeMeta{
95-
Kind: "Backup",
96-
APIVersion: "postgresql.cnpg.io/v1",
97-
},
98-
ObjectMeta: metav1.ObjectMeta{
99-
Name: "initial-backup",
100-
Namespace: namespace,
101-
},
102-
Spec: cloudnativepgv1.BackupSpec{
103-
Cluster: cloudnativepgv1.LocalObjectReference{
104-
Name: clusterName,
105-
},
106-
Method: "plugin",
107-
Target: "primary",
108-
PluginConfiguration: &cloudnativepgv1.BackupPluginConfiguration{
109-
Name: "pgbackrest.cnpg.opera.com",
110-
},
111-
},
112-
}
113-
}
114-
115-
func newPluginBackup(namespace string) *cloudnativepgv1.Backup {
116-
return &cloudnativepgv1.Backup{
91+
// createPluginBackup creates a backup resource to initialize the pgBackRest stanza
92+
func createPluginBackup(namespace string) *cloudnativepgv1.Backup {
93+
backup := &cloudnativepgv1.Backup{
11794
TypeMeta: metav1.TypeMeta{
11895
Kind: "Backup",
11996
APIVersion: "postgresql.cnpg.io/v1",
@@ -134,4 +111,5 @@ func newPluginBackup(namespace string) *cloudnativepgv1.Backup {
134111
},
135112
},
136113
}
114+
return backup
137115
}

test/e2e/internal/tests/parallelarchive/parallel_archive.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,11 @@ var _ = Describe("Parallel WAL Archive", func() {
9090
cfg,
9191
command.ContainerLocator{
9292
NamespaceName: cluster.Namespace,
93-
PodName: fmt.Sprintf("%v-1", cluster.Name),
93+
PodName: fmt.Sprintf("%s-1", cluster.Name),
9494
ContainerName: "postgres",
9595
},
9696
nil,
97-
[]string{"psql", "-tAc", "CREATE TABLE parallel_test (id int, data text, created_at timestamp DEFAULT now());"})
98-
Expect(err).NotTo(HaveOccurred())
99-
100-
_, _, err = command.ExecuteInContainer(ctx,
101-
*clientSet,
102-
cfg,
103-
command.ContainerLocator{
104-
NamespaceName: cluster.Namespace,
105-
PodName: fmt.Sprintf("%v-1", cluster.Name),
106-
ContainerName: "postgres",
107-
},
108-
nil,
109-
[]string{"psql", "-tAc", "INSERT INTO parallel_test (id, data) VALUES (0, 'before_backup');"})
97+
[]string{"psql", "-tAc", "CREATE TABLE parallel_test (id int, data text);"})
11098
Expect(err).NotTo(HaveOccurred())
11199

112100
By("creating a backup to initialize pgBackRest stanza")
@@ -123,7 +111,7 @@ var _ = Describe("Parallel WAL Archive", func() {
123111
By("rapidly generating multiple WAL files to queue them for archiving")
124112
// Generate 10 WAL switches in quick succession to create a backlog
125113
// that can be processed in parallel
126-
for i := 1; i <= 10; i++ {
114+
for i := 0; i < 10; i++ {
127115
_, _, err := command.ExecuteInContainer(ctx,
128116
*clientSet,
129117
cfg,

0 commit comments

Comments
 (0)