Skip to content

Commit

Permalink
e2e: fix failing tests due to region name change. (#24713)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasell authored Dec 19, 2024
1 parent 04e930b commit 8bb7c13
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
6 changes: 3 additions & 3 deletions e2e/cni/cni_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
7 changes: 4 additions & 3 deletions e2e/cni/input/cni_args.nomad.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down
19 changes: 2 additions & 17 deletions e2e/jobsubmissions/jobsubapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -149,19 +145,15 @@ 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)

// create a namespace for a token that will be blocked
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)

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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,
})
Expand All @@ -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,
})
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8bb7c13

Please sign in to comment.