Skip to content

Commit bb37add

Browse files
committed
WIP - test steps cleanup
1 parent aa7e417 commit bb37add

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

internal/k8s/configuration_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,8 @@ func TestAddVirtualServerWithVirtualServerRoutes(t *testing.T) {
11891189

11901190
// Add VirtualServerRoute-1
11911191

1192-
vsr1 := createTestVirtualServerRoute("virtualserverroute-1", "foo.example.com", "/first", nil)
1192+
labels := make(map[string]string)
1193+
vsr1 := createTestVirtualServerRoute("virtualserverroute-1", "foo.example.com", "/first", labels)
11931194
var expectedChanges []ResourceChange
11941195
expectedProblems := []ConfigurationProblem{
11951196
{

internal/k8s/configuration_vsr_test.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ import (
1010

1111
// WIP - Jakub
1212
func TestAddVirtualServerVSR(t *testing.T) {
13-
configuration := createTestConfiguration()
14-
15-
// no problems are expected for all cases
16-
var expectedProblems []ConfigurationProblem
1713

1814
// Add a VirtualServer
19-
2015
vs := createTestVirtualServer("virtualserver", "foo.example.com")
2116
expectedChanges := []ResourceChange{
2217
{
@@ -27,13 +22,22 @@ func TestAddVirtualServerVSR(t *testing.T) {
2722
},
2823
}
2924

25+
// =========
26+
// Note: call t.Fatal() as there is no point to carry on and update the VS if the VS is not created
27+
// meaning we have errors or `problems` when creating the VS.
28+
configuration := createTestConfiguration()
29+
// no problems are expected for all cases
30+
var expectedProblems []ConfigurationProblem
31+
3032
changes, problems := configuration.AddOrUpdateVirtualServer(vs)
31-
if diff := cmp.Diff(expectedChanges, changes); diff != "" {
32-
t.Errorf("AddOrUpdateVirtualServer() returned unexpected result (-want +got):\n%s", diff)
33+
34+
if !cmp.Equal(expectedChanges, changes) {
35+
t.Fatal(cmp.Diff(expectedChanges, changes))
3336
}
34-
if diff := cmp.Diff(expectedProblems, problems); diff != "" {
35-
t.Errorf("AddOrUpdateVirtualServer() returned unexpected result (-want +got):\n%s", diff)
37+
if !cmp.Equal(expectedProblems, problems) {
38+
t.Fatal(cmp.Diff(expectedProblems, problems))
3639
}
40+
// =========
3741

3842
// Update VirtualServer
3943

0 commit comments

Comments
 (0)