Skip to content

Commit 8b7631c

Browse files
committed
add multi-etcd support to testing framework
On-behalf-of: @SAP [email protected]
1 parent 18a8c54 commit 8b7631c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/e2e/rootshards/rootshards_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func TestCreateRootShard(t *testing.T) {
4444
namespace := "create-rootshard"
4545

4646
utils.CreateSelfDestructingNamespace(t, ctx, client, namespace)
47-
etcd := utils.DeployEtcd(t, namespace)
47+
etcd := utils.DeployEtcd(t, "etcd", namespace)
4848

4949
rootShard := kcpoperatorv1alpha1.RootShard{}
5050
rootShard.Name = "test"

test/utils/utils.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ func ConnectWithKubeconfig(
210210
return kcpClient
211211
}
212212

213-
func DeployEtcd(t *testing.T, namespace string) string {
213+
func DeployEtcd(t *testing.T, name, namespace string) string {
214214
t.Helper()
215215

216-
t.Logf("Installing etcd into %s…", namespace)
216+
t.Logf("Installing etcd %q into %s…", name, namespace)
217217
args := []string{
218218
"install",
219-
"etcd",
219+
name,
220220
"oci://registry-1.docker.io/bitnamicharts/etcd",
221221
"--namespace", namespace,
222222
"--version", "10.7.1", // latest version at the time of writing
@@ -233,7 +233,7 @@ func DeployEtcd(t *testing.T, namespace string) string {
233233
"wait",
234234
"pods",
235235
"--namespace", namespace,
236-
"--selector", "app.kubernetes.io/name=etcd",
236+
"--selector", fmt.Sprintf("app.kubernetes.io/name=etcd,app.kubernetes.io/instance=%s", name),
237237
"--for", "condition=Ready",
238238
"--timeout", "3m",
239239
}
@@ -242,5 +242,5 @@ func DeployEtcd(t *testing.T, namespace string) string {
242242
t.Fatalf("Failed to wait for etcd to become ready: %v", err)
243243
}
244244

245-
return fmt.Sprintf("http://etcd.%s.svc.cluster.local:2379", namespace)
245+
return fmt.Sprintf("http://%s.%s.svc.cluster.local:2379", name, namespace)
246246
}

0 commit comments

Comments
 (0)