Skip to content

Commit 28ed4b9

Browse files
test(debug): wait for config entries before gateway tests (#5133)
* test(debug): wait for config entries before gateway tests * update pr
1 parent 106d404 commit 28ed4b9

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches:
77
- main
88
- "release/**"
9+
- "sanikachavan**"
910

1011
# these should be the only settings that you will ever need to change
1112
env:

acceptance/tests/partitions/partitions_gateway_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,25 @@ func TestPartitions_Gateway(t *testing.T) {
213213
k8s.KubectlDeleteK(t, secondaryPartitionClusterContext.KubectlOptions(t), kustomizeDir)
214214
})
215215

216+
// Ensure proxy-defaults config entries are created in Consul before proceeding.
217+
// This is critical for mesh gateways to be properly configured for TLS.
218+
logger.Log(t, "waiting for proxy-defaults config entries to be created in Consul")
219+
retry.Run(t, func(r *retry.R) {
220+
ceDefault, _, err := consulClient.ConfigEntries().Get(api.ProxyDefaults, api.ProxyConfigGlobal, serverQueryServerOpts)
221+
require.NoError(r, err)
222+
configEntryDefault, ok := ceDefault.(*api.ProxyConfigEntry)
223+
require.True(r, ok)
224+
require.Equal(r, configEntryDefault.GetName(), api.ProxyConfigGlobal)
225+
logger.Log(t, "proxy-defaults config entry verified on default partition")
226+
227+
ceSecondary, _, err := consulClient.ConfigEntries().Get(api.ProxyDefaults, api.ProxyConfigGlobal, serverQueryClientOpts)
228+
require.NoError(r, err)
229+
configEntrySecondary, ok := ceSecondary.(*api.ProxyConfigEntry)
230+
require.True(r, ok)
231+
require.Equal(r, configEntrySecondary.GetName(), api.ProxyConfigGlobal)
232+
logger.Log(t, "proxy-defaults config entry verified on secondary partition")
233+
})
234+
216235
// We use the static-client pod so that we can make calls to the api gateway
217236
// via kubectl exec without needing a route into the cluster from the test machine.
218237
// Since we're deploying the gateway in the secondary cluster, we create the static client

acceptance/tests/sameness/sameness_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,23 @@ func TestFailover_Connect(t *testing.T) {
349349
}
350350
}
351351

352+
// Ensure mesh config entries are created in Consul before proceeding with peering.
353+
// This is critical for mesh gateways to be properly configured for TLS.
354+
logger.Log(t, "waiting for mesh config entries to be created in Consul")
355+
timer := &retry.Timer{Timeout: retryTimeout, Wait: 5 * time.Second}
356+
for _, v := range testClusters {
357+
if v.hasServer {
358+
retry.RunWith(timer, t, func(r *retry.R) {
359+
ce, _, err := v.client.ConfigEntries().Get(api.MeshConfig, "mesh", &api.QueryOptions{})
360+
require.NoError(r, err)
361+
configEntry, ok := ce.(*api.MeshConfigEntry)
362+
require.True(r, ok)
363+
require.Equal(r, configEntry.GetName(), "mesh")
364+
logger.Logf(t, "mesh config entry verified on cluster %s", v.name)
365+
})
366+
}
367+
}
368+
352369
// Apply locality to clusters
353370
for _, v := range testClusters {
354371
setK8sNodeLocality(t, v.context, v)

0 commit comments

Comments
 (0)