e2e: fix failing tests due to region name change. (#24713)

This commit is contained in:
James Rasell
2024-12-19 15:21:17 +01:00
committed by GitHub
parent 04e930b756
commit 8bb7c1315d
3 changed files with 9 additions and 23 deletions

View File

@@ -40,7 +40,7 @@ func testCNIArgs(t *testing.T) {
job, _ := jobs3.Submit(t, "./input/cni_args.nomad.hcl")
logs := job.Exec("group", "task", []string{"cat", "local/victory"})
t.Logf("FancyMessage: %s", logs.Stdout)
// "global" is the Nomad node's region, interpolated in the jobspec,
// passed through the CNI plugin, and cat-ed by the task.
must.Eq(t, "global\n", logs.Stdout)
// "default" is the Nomad node's pool, interpolated in the jobspec, passed
// through the CNI plugin, and cat-ed by the task.
must.Eq(t, "default\n", logs.Stdout)
}

View File

@@ -8,9 +8,10 @@ job "cni_args" {
cni {
# feature under test
args = {
# the message gets placed as a file called "victory"
# in the task dir specified here by the cni_args.sh plugin
FancyMessage = "${node.region}"
# the message gets placed as a file called "victory" in the task dir
# specified here by the cni_args.sh plugin. Using node pool allows us
# to test interpolation as an extra.
FancyMessage = "${node.pool}"
FancyTaskDir = "${NOMAD_ALLOC_DIR}/task/local"
}
}

View File

@@ -75,7 +75,6 @@ func testRunCLIVarFlags(t *testing.T) {
// check the submission api
sub, _, err := nomad.Jobs().Submission(jobID, 0, &api.QueryOptions{
Region: "global",
Namespace: "default",
})
must.NoError(t, err)
@@ -101,7 +100,6 @@ func testRunCLIVarFlags(t *testing.T) {
// check the submission api for v1
sub, _, err = nomad.Jobs().Submission(jobID, 1, &api.QueryOptions{
Region: "global",
Namespace: "default",
})
must.NoError(t, err)
@@ -112,7 +110,6 @@ func testRunCLIVarFlags(t *testing.T) {
// check the submission api for v0 (make sure we still have it)
sub, _, err = nomad.Jobs().Submission(jobID, 0, &api.QueryOptions{
Region: "global",
Namespace: "default",
})
must.NoError(t, err)
@@ -130,7 +127,6 @@ func testRunCLIVarFlags(t *testing.T) {
// check the submission api for v0 after deregister (make sure its gone)
sub, _, err = nomad.Jobs().Submission(jobID, 0, &api.QueryOptions{
Region: "global",
Namespace: "default",
})
must.ErrorContains(t, err, "job source not found")
@@ -149,9 +145,7 @@ func testSubmissionACL(t *testing.T) {
namespaceClient := nomad.Namespaces()
_, err := namespaceClient.Register(&api.Namespace{
Name: myNamespaceName,
}, &api.WriteOptions{
Region: "global",
})
}, &api.WriteOptions{})
must.NoError(t, err)
aclCleanup.Add(myNamespaceName, acl.NamespaceTestResourceType)
@@ -159,9 +153,7 @@ func testSubmissionACL(t *testing.T) {
otherNamespaceName := "submission-other-acl-" + uuid.Short()
_, err = namespaceClient.Register(&api.Namespace{
Name: otherNamespaceName,
}, &api.WriteOptions{
Region: "global",
})
}, &api.WriteOptions{})
must.NoError(t, err)
aclCleanup.Add(otherNamespaceName, acl.NamespaceTestResourceType)
@@ -192,7 +184,6 @@ func testSubmissionACL(t *testing.T) {
Type: "client",
Policies: []string{myNamespacePolicy.Name},
}, &api.WriteOptions{
Region: "global",
Namespace: myNamespaceName,
})
must.NoError(t, err)
@@ -204,7 +195,6 @@ func testSubmissionACL(t *testing.T) {
Type: "client",
Policies: []string{otherNamespacePolicy.Name},
}, &api.WriteOptions{
Region: "global",
Namespace: otherNamespaceName,
})
must.NoError(t, err)
@@ -232,7 +222,6 @@ func testSubmissionACL(t *testing.T) {
// get submission using my token
sub, _, err := nomad.Jobs().Submission(jobID, 0, &api.QueryOptions{
Region: "global",
Namespace: myNamespaceName,
AuthToken: myToken.SecretID,
})
@@ -244,7 +233,6 @@ func testSubmissionACL(t *testing.T) {
// get submission using other token (fail)
sub, _, err = nomad.Jobs().Submission(jobID, 0, &api.QueryOptions{
Region: "global",
Namespace: myNamespaceName,
AuthToken: otherToken.SecretID,
})
@@ -274,7 +262,6 @@ func testMaxSize(t *testing.T) {
// check the submission api making sure it is not there
nomad := e2eutil.NomadClient(t)
sub, _, err := nomad.Jobs().Submission(jobID, 0, &api.QueryOptions{
Region: "global",
Namespace: "default",
})
must.ErrorContains(t, err, "job source not found")
@@ -313,7 +300,6 @@ func testReversion(t *testing.T) {
expectY := []string{"0", "1", "2", "1"}
for version := 0; version < 4; version++ {
sub, _, err := nomad.Jobs().Submission(jobID, version, &api.QueryOptions{
Region: "global",
Namespace: "default",
})
must.NoError(t, err)
@@ -348,7 +334,6 @@ func testVarFiles(t *testing.T) {
// get submission
sub, _, err := nomad.Jobs().Submission(jobID, version, &api.QueryOptions{
Region: "global",
Namespace: "default",
})
must.NoError(t, err)