Browse Source

[ipvs] Add tests for get/set timeout

Signed-off-by: Laurent Bernaille <laurent.bernaille@datadoghq.com>
Laurent Bernaille 6 years ago
parent
commit
8e650a9685
1 changed files with 22 additions and 0 deletions
  1. 22 0
      libnetwork/ipvs/ipvs_test.go

+ 22 - 0
libnetwork/ipvs/ipvs_test.go

@@ -6,6 +6,7 @@ import (
 	"net"
 	"net"
 	"syscall"
 	"syscall"
 	"testing"
 	"testing"
+	"time"
 
 
 	"github.com/docker/libnetwork/testutils"
 	"github.com/docker/libnetwork/testutils"
 	"github.com/vishvananda/netlink"
 	"github.com/vishvananda/netlink"
@@ -342,3 +343,24 @@ func TestDestination(t *testing.T) {
 		}
 		}
 	}
 	}
 }
 }
+
+func TestTimeouts(t *testing.T) {
+	if testutils.RunningOnCircleCI() {
+		t.Skip("Skipping as not supported on CIRCLE CI kernel")
+	}
+	defer testutils.SetupTestOSContext(t)()
+
+	i, err := New("")
+	assert.NilError(t, err)
+
+	_, err = i.GetConfig()
+	assert.NilError(t, err)
+
+	cfg := Config{66 * time.Second, 66 * time.Second, 66 * time.Second}
+	err = i.SetConfig(&cfg)
+	assert.NilError(t, err)
+
+	c2, err := i.GetConfig()
+	assert.NilError(t, err)
+	assert.DeepEqual(t, cfg, *c2)
+}