Skip to content

Commit

Permalink
Added status testing on hostnames (link goes up and down), but shelve…
Browse files Browse the repository at this point in the history
…d for now

The test is failing, probably because of a bug in skupper.  I'll keep
only the create tester for today at least, to avoid unnecessary warnings
on the CI

Signed-off-by: Danilo Gonzalez Hashimoto <[email protected]>
  • Loading branch information
hash-d committed Jul 2, 2022
1 parent 2f91042 commit dc39730
Showing 1 changed file with 80 additions and 5 deletions.
85 changes: 80 additions & 5 deletions test/integration/acceptance/custom/hello_policy/hostnames_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ func testHostnamesPolicy(t *testing.T, pub, prv *base.ClusterContext) {
},
}

// Creation testing, tied to claim hostname
createTestTable := []policyTestCase{}

createTester := []cli.TestScenario{
createLinkTestScenario(prv, "", "hostnames", false),
linkStatusTestScenario(prv, "", "hostnames", true),
Expand All @@ -215,8 +218,6 @@ func testHostnamesPolicy(t *testing.T, pub, prv *base.ClusterContext) {
createLinkTestScenario(prv, "", "hostnames", true),
}

createTestTable := []policyTestCase{}

for _, t := range tests {
var createTestCase policyTestCase
var name string
Expand Down Expand Up @@ -250,16 +251,90 @@ func testHostnamesPolicy(t *testing.T, pub, prv *base.ClusterContext) {
createTestTable = append(createTestTable, createTestCase)
}

// status testing, tied to router hostname (link being establised)
statusTestTable := []policyTestCase{}

statusTester := []cli.TestScenario{
linkStatusTestScenario(prv, "", "hostnames", true),
}

failStatusTester := []cli.TestScenario{
linkStatusTestScenario(prv, "", "hostnames", false),
}

for _, t := range tests {
var statusTestCase policyTestCase
var name string
var scenarios []cli.TestScenario

if t.allowed {
name = "succeed"
scenarios = statusTester
} else {
name = "fail"
scenarios = failStatusTester
}

transformation := t.transformation

statusTestCase = policyTestCase{
name: t.name,
steps: []policyTestStep{
{
name: name,
prvPolicy: []v1alpha1.SkupperClusterPolicySpec{
allowedOutgoingLinksHostnamesPolicy(
prv.Namespace,
[]string{"{{.claim}}", "{{.router}}"},
),
},
cliScenarios: scenarios,
preHook: func(c map[string]string) error {
c[claim] = transformation(c[originalClaim])
c[router] = transformation(c[originalRouter])
return nil
},
},
},
}
statusTestTable = append(statusTestTable, statusTestCase)
}

linkForStatus := []policyTestCase{
{
name: "create-link-for-status-testing",
steps: []policyTestStep{
{
name: "create",
prvPolicy: []v1alpha1.SkupperClusterPolicySpec{
allowedOutgoingLinksHostnamesPolicy(prv.Namespace, []string{"*"}),
},
cliScenarios: []cli.TestScenario{
createLinkTestScenario(prv, "", "hostnames", false),
linkStatusTestScenario(prv, "", "hostnames", true),
},
},
},
},
}

testTable := []policyTestCase{}
for _, t := range [][]policyTestCase{init, createTestTable, cleanup} {
for _, t := range [][]policyTestCase{
init,
createTestTable,
linkForStatus,
//statusTestTable,
cleanup,
} {
testTable = append(testTable, t...)
}

var context = map[string]string{}

policyTestRunner{
testCases: testTable,
contextMap: context,
testCases: testTable,
contextMap: context,
keepPolicies: true,
// We allow everything on both clusters, except for hostnames
pubPolicies: []v1alpha1.SkupperClusterPolicySpec{
{
Expand Down

0 comments on commit dc39730

Please sign in to comment.