diff --git a/beacon/beacon_test.go b/beacon/beacon_test.go index c4cbd4e0..949fe5a8 100644 --- a/beacon/beacon_test.go +++ b/beacon/beacon_test.go @@ -1,3 +1,7 @@ +// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). +// All rights reserved. Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + package beacon import ( diff --git a/config/config_test.go b/config/config_test.go index 2caa823d..f274b680 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -131,6 +131,13 @@ func TestNodeConfig(t *testing.T) { if !reflect.DeepEqual(cfg.Repositories[0].NodeIDs(), expectedNodeIDs) { t.Errorf("%d: Incorrect NodeIDs\n A: %#v\n E: %#v", i, cfg.Repositories[0].NodeIDs(), expectedNodeIDs) } + + if len(cfg.NodeMap()) != len(expectedNodes) { + t.Errorf("Unexpected number of NodeMap() entries") + } + if len(cfg.RepoMap()) != len(expectedRepos) { + t.Errorf("Unexpected number of RepoMap() entries") + } } } @@ -291,3 +298,37 @@ func TestNodeAddressesStatic(t *testing.T) { t.Errorf("Nodes differ;\n E: %#v\n A: %#v", expected, cfg.Nodes) } } + +func TestVersioningConfig(t *testing.T) { + data := []byte(` + + + + + + + + + `) + + cfg, err := Load(bytes.NewReader(data), node4) + if err != nil { + t.Error(err) + } + + vc := cfg.Repositories[0].Versioning + if vc.Type != "simple" { + t.Errorf(`vc.Type %q != "simple"`, vc.Type) + } + if l := len(vc.Params); l != 2 { + t.Errorf("len(vc.Params) %d != 2", l) + } + + expected := map[string]string{ + "foo": "bar", + "baz": "quux", + } + if !reflect.DeepEqual(vc.Params, expected) { + t.Errorf("vc.Params differ;\n E: %#v\n A: %#v", expected, vc.Params) + } +}