get test working again

This commit is contained in:
John R. Lenton
2016-08-05 03:07:01 +01:00
parent 47a6bf0141
commit 40e387deae
4 changed files with 9 additions and 4 deletions

View File

@@ -54,6 +54,7 @@ type clientSuite struct {
var _ = check.Suite(&clientSuite{})
func (cs *clientSuite) SetUpTest(c *check.C) {
os.Setenv(client.TestAuthFileEnvKey, filepath.Join(c.MkDir(), "auth.json"))
cs.cli = client.New(nil)
cs.cli.SetDoer(cs)
cs.err = nil
@@ -66,6 +67,10 @@ func (cs *clientSuite) SetUpTest(c *check.C) {
dirs.SetRootDir(c.MkDir())
}
func (cs *clientSuite) TearDownTest(c *check.C) {
os.Unsetenv(client.TestAuthFileEnvKey)
}
func (cs *clientSuite) Do(req *http.Request) (*http.Response, error) {
cs.req = req
rsp := &http.Response{

View File

@@ -9,7 +9,7 @@ restore: |
execute: |
echo "An unauthenticated user cannot install snaps"
if sudo -i -u test /bin/sh -c "snap install test-snapd-tools 2>${PWD}/install.output"; then
if su - -c "snap install test-snapd-tools 2>${PWD}/install.output" test; then
echo "Expected error installing snap from unauthenticated account"
exit 1
fi
@@ -17,7 +17,7 @@ execute: |
[ "$(cat install.output)" = "$expected" ]
echo "An unauthenticated user cannot connect plugs to slots"
if sudo -i -u test /bin/sh -c "snap connect foo:bar baz:fromp 2>${PWD}/connect.output"; then
if su - -c "snap connect foo:bar baz:fromp 2>${PWD}/connect.output" test; then
echo "Expected error connecting plugs to slots from unauthenticated account"
exit 1
fi

View File

@@ -10,7 +10,7 @@ execute: |
echo Ensure we really build with gccgo
go version|grep gccgo
echo Build the deb with gccgo and run the tests as part of the build
sudo -i -u test /bin/sh -c "cd /gopath/src/github.com/snapcore/snapd && dpkg-buildpackage -tc -Zgzip"
su - -c "cd /gopath/src/github.com/snapcore/snapd && dpkg-buildpackage -tc -Zgzip" test
# Tests run during package build take a while.
warn-timeout: 8m

View File

@@ -25,7 +25,7 @@ execute: |
echo "============================================"
echo "Install points to sudo when not authenticated"
if sudo -i -u test /bin/sh -c "snap install $SNAP_NAME 2>${PWD}/install.output"; then
if su - -c "snap install $SNAP_NAME 2>${PWD}/install.output" test; then
echo "Unauthenticated install should fail"
exit 1
fi