From 48a892bee5270feea3d0e7b64963acb38dbd634b Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 16 Jul 2013 15:58:23 +0000 Subject: [PATCH] Add CompareConfig test --- utils_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/utils_test.go b/utils_test.go index af2dcc88c5..31489446f8 100644 --- a/utils_test.go +++ b/utils_test.go @@ -129,6 +129,30 @@ func runContainer(r *Runtime, args []string, t *testing.T) (output string, err e return } +func TestCompareConfig(t *testing.T) { + config1 := Config{ + Dns: []string{"1.1.1.1", "2.2.2.2"}, + PortSpecs: []string{"1111:1111", "2222:2222"}, + Env: []string{"VAR1=1", "VAR2=2"}, + } + config2 := Config{ + Dns: []string{"0.0.0.0", "2.2.2.2"}, + PortSpecs: []string{"1111:1111", "2222:2222"}, + Env: []string{"VAR1=1", "VAR2=2"}, + } + config3 := Config{ + Dns: []string{"1.1.1.1", "2.2.2.2"}, + PortSpecs: []string{"0000:0000", "2222:2222"}, + Env: []string{"VAR1=1", "VAR2=2"}, + } + if CompareConfig(&config1, &config2) { + t.Fatalf("CompareConfig should return false, Dns are different") + } + if CompareConfig(&config1, &config3) { + t.Fatalf("CompareConfig should return false, PortSpecs are different") + } +} + func TestMergeConfig(t *testing.T) { volumesImage := make(map[string]struct{}) volumesImage["/test1"] = struct{}{}