mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
get test working again
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user