diff --git a/cmd/entrypoint/testdata/unrelated-mappings/mapping3.yaml b/cmd/entrypoint/testdata/unrelated-mappings/mapping3.yaml new file mode 100644 index 0000000000..ec193a83b0 --- /dev/null +++ b/cmd/entrypoint/testdata/unrelated-mappings/mapping3.yaml @@ -0,0 +1,31 @@ + +apiVersion: getambassador.io/v2 +kind: Mapping +metadata: + labels: + app: workload1 + name: workload1-mapping + namespace: infrastructure +spec: + bypass_auth: true + host: test.example.com + prefix: / + rewrite: "" + service: workload1 + timeout_ms: 3000 + weight: 20 +--- +apiVersion: getambassador.io/v2 +kind: Mapping +metadata: + labels: + app: workload3 + name: workload3-mapping + namespace: infrastructure +spec: + bypass_auth: true + host: test.example.com + prefix: / + rewrite: "" + service: workload3 + timeout_ms: 3000 diff --git a/cmd/entrypoint/unrelated_mappings_test.go b/cmd/entrypoint/unrelated_mappings_test.go index a0232abfc3..de9983c58a 100644 --- a/cmd/entrypoint/unrelated_mappings_test.go +++ b/cmd/entrypoint/unrelated_mappings_test.go @@ -188,4 +188,15 @@ func TestUnrelatedMappings(t *testing.T) { "workload1-mapping": NewWeightCheck(-1, 100), "workload2-mapping": NewWeightCheck(50, 50), }) + + // Finally, do something complex: update the weight of workload1-mapping, + // add a workload3-mapping, and reintroduce the unrelated mapping. + assert.NoError(t, f.UpsertFile("testdata/unrelated-mappings/mapping3.yaml")) + assert.NoError(t, f.UpsertFile("testdata/unrelated-mappings/unrelated.yaml")) + + checkIR(f, "complex 1", map[string]WeightCheck{ + "workload1-mapping": NewWeightCheck(20, 20), + "workload2-mapping": NewWeightCheck(50, 70), + "workload3-mapping": NewWeightCheck(-1, 100), + }) }