@@ -10,13 +10,8 @@ import (
1010
1111// WIP - Jakub
1212func 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