17086: Merge branch 'master' into 17086-add-focal-fossa
[arvados.git] / services / keepstore / command_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package main
6
7 import (
8         "bytes"
9         "io/ioutil"
10         "os"
11
12         check "gopkg.in/check.v1"
13 )
14
15 var _ = check.Suite(&CommandSuite{})
16
17 type CommandSuite struct{}
18
19 func (*CommandSuite) TestLegacyConfigPath(c *check.C) {
20         var stdin, stdout, stderr bytes.Buffer
21         tmp, err := ioutil.TempFile("", "")
22         c.Assert(err, check.IsNil)
23         defer os.Remove(tmp.Name())
24         tmp.Write([]byte("Listen: \"1.2.3.4.5:invalidport\"\n"))
25         tmp.Close()
26         exited := runCommand("keepstore", []string{"-config", tmp.Name()}, &stdin, &stdout, &stderr)
27         c.Check(exited, check.Equals, 1)
28         c.Check(stderr.String(), check.Matches, `(?ms).*unable to migrate Listen value.*`)
29 }