1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
8 "github.com/ghodss/yaml"
9 check "gopkg.in/check.v1"
12 var _ = check.Suite(&ConfigSuite{})
14 type ConfigSuite struct{}
16 func (s *ConfigSuite) TestInstanceTypesAsArray(c *check.C) {
18 yaml.Unmarshal([]byte(`
20 DisabledAPIs: [jobs.list]`), &cluster)
21 c.Check(len(cluster.API.DisabledAPIs), check.Equals, 1)
22 _, ok := cluster.API.DisabledAPIs["jobs.list"]
23 c.Check(ok, check.Equals, true)
26 func (s *ConfigSuite) TestStringSetAsArray(c *check.C) {
28 yaml.Unmarshal([]byte("InstanceTypes:\n- Name: foo\n"), &cluster)
29 c.Check(len(cluster.InstanceTypes), check.Equals, 1)
30 c.Check(cluster.InstanceTypes["foo"].Name, check.Equals, "foo")
33 func (s *ConfigSuite) TestInstanceTypesAsHash(c *check.C) {
35 yaml.Unmarshal([]byte("InstanceTypes:\n foo:\n ProviderType: bar\n"), &cluster)
36 c.Check(len(cluster.InstanceTypes), check.Equals, 1)
37 c.Check(cluster.InstanceTypes["foo"].Name, check.Equals, "foo")
38 c.Check(cluster.InstanceTypes["foo"].ProviderType, check.Equals, "bar")
41 func (s *ConfigSuite) TestInstanceTypeSize(c *check.C) {
43 err := yaml.Unmarshal([]byte("Name: foo\nScratch: 4GB\nRAM: 4GiB\n"), &it)
44 c.Check(err, check.IsNil)
45 c.Check(int64(it.Scratch), check.Equals, int64(4000000000))
46 c.Check(int64(it.RAM), check.Equals, int64(4294967296))