Skip to content

Commit

Permalink
More obnoxiousness (change an existing mapping and add.a new related …
Browse files Browse the repository at this point in the history
…mapping in one step)

Signed-off-by: Flynn <[email protected]>
  • Loading branch information
kflynn committed Jul 20, 2024
1 parent ba19944 commit cfbb851
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/entrypoint/testdata/unrelated-mappings/mapping3.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions cmd/entrypoint/unrelated_mappings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
}

0 comments on commit cfbb851

Please sign in to comment.