func (s *EntrySuite) TestEntriesCreateFailure(c *gc.C) { c.ExpectFailure("cannot create an entry") ft.Entries{ ft.File{"good", "good", 0750}, ft.File{"nodir/bad", "bad", 0640}, }.Create(c, s.basePath) }
func (s *EntrySuite) TestRemovedCreateFailure(c *gc.C) { ft.File{"some-file", "content", 0644}.Create(c, s.basePath) os.Chmod(s.basePath, 0444) defer os.Chmod(s.basePath, 0777) c.ExpectFailure("should fail to remove file") ft.Removed{"some-file"}.Create(c, s.basePath) }
func (s *EntrySuite) TestEntriesCheckFailure(c *gc.C) { goodFile := ft.File{"good", "good", 0751}.Create(c, s.basePath) c.ExpectFailure("entry does not exist") ft.Entries{ goodFile, ft.File{"bad", "", 0750}, }.Check(c, s.basePath) }
func (s *clientSuite) TestDebugLogAtUUIDLogPath(c *gc.C) { s.PatchValue(api.WebsocketDialConfig, echoURL(c)) // If the server supports it, we should log at "/environment/UUID/log" environ, err := s.State.Environment() c.Assert(err, gc.IsNil) info := s.APIInfo(c) info.EnvironTag = environ.Tag() apistate, err := api.Open(info, api.DialOpts{}) c.Assert(err, gc.IsNil) defer apistate.Close() reader, err := apistate.Client().WatchDebugLog(api.DebugLogParams{}) c.Assert(err, gc.IsNil) connectURL := connectURLFromReader(c, reader) c.ExpectFailure("debug log always goes to /log for compatibility http://pad.lv/1326799") c.Assert(connectURL.Path, gc.Matches, fmt.Sprintf("/%s/log", environ.UUID())) }
func (s *EntrySuite) TestFileCheckFailureBadPerm(c *gc.C) { ft.File{"furble", "pingle", 0644}.Create(c, s.basePath) c.ExpectFailure("shouldn't pass with different perms") ft.File{"furble", "pingle", 0740}.Check(c, s.basePath) }
func (s *EntrySuite) TestFileCheckFailureBadData(c *gc.C) { ft.File{"furble", "pingle", 0740}.Check(c, s.basePath) c.ExpectFailure("shouldn't pass with different content") ft.File{"furble", "wrongle", 0740}.Check(c, s.basePath) }
func (s *EntrySuite) TestDirCheckFailureBadPerm(c *gc.C) { ft.Dir{"furble", 0740}.Check(c, s.basePath) c.ExpectFailure("shouldn't pass with different perms") ft.Dir{"furble", 0755}.Check(c, s.basePath) }
func (s *EntrySuite) TestFileCreateFailure(c *gc.C) { c.ExpectFailure("should fail to create file in missing dir") ft.File{"missing/foobar", "hello", 0644}.Create(c, s.basePath) }
func (s *EntrySuite) TestRemovedCheckFailureSymlink(c *gc.C) { ft.Symlink{"some-link", "target"}.Create(c, s.basePath) c.ExpectFailure("should not accept symlink") ft.Removed{"some-link"}.Check(c, s.basePath) }
func (s *EntrySuite) TestDirCheckFailureSymlink(c *gc.C) { ft.Symlink{"link", "dir"}.Create(c, s.basePath) ft.Dir{"dir", 0644}.Create(c, s.basePath) c.ExpectFailure("shouldn't accept symlink, even if pointing to matching dir") ft.Dir{"link", 0644}.Check(c, s.basePath) }
func (s *ExpectFailureSucceedHelper) TestSucceed(c *gocheck.C) { c.ExpectFailure("It booms!") c.Error("Boom!") }
func (s *EntrySuite) TestSymlinkCreateFailure(c *gc.C) { c.ExpectFailure("should fail to create symlink in missing dir") ft.Symlink{"missing/link", "target"}.Create(c, s.basePath) }
func (s *EntrySuite) TestSymlinkCheckFailureDir(c *gc.C) { ft.Dir{"link", 0755}.Create(c, s.basePath) c.ExpectFailure("should not accept dir") ft.Symlink{"link", "different"}.Check(c, s.basePath) }
func (s *EntrySuite) TestFileCheckFailureDir(c *gc.C) { ft.Dir{"furble", 0740}.Create(c, s.basePath) c.ExpectFailure("shouldn't accept dir") ft.File{"furble", "pingle", 0740}.Check(c, s.basePath) }
func (s *EntrySuite) TestSymlinkCheckFailureFile(c *gc.C) { ft.File{"link", "target", 0644}.Create(c, s.basePath) c.ExpectFailure("should not accept plain file") ft.Symlink{"link", "target"}.Check(c, s.basePath) }
func (s *EntrySuite) TestSymlinkCheckFailureBadTarget(c *gc.C) { ft.Symlink{"link", "target"}.Create(c, s.basePath) c.ExpectFailure("should not accept different target") ft.Symlink{"link", "different"}.Check(c, s.basePath) }
func (s *EntrySuite) TestSymlinkCheckFailureNoExist(c *gc.C) { c.ExpectFailure("should not accept symlink that doesn't exist") ft.Symlink{"link", "target"}.Check(c, s.basePath) }
func (s *EntrySuite) TestFileCheckFailureNoExist(c *gc.C) { c.ExpectFailure("shouldn't find file that does not exist") ft.File{"furble", "pingle", 0740}.Check(c, s.basePath) }
func (s *EntrySuite) TestDirCheckFailureNoExist(c *gc.C) { c.ExpectFailure("shouldn't find dir that does not exist") ft.Dir{"fooble", 0751}.Check(c, s.basePath) }
func (s *EntrySuite) TestFileCheckFailureSymlink(c *gc.C) { ft.Symlink{"link", "file"}.Create(c, s.basePath) ft.File{"file", "content", 0644}.Create(c, s.basePath) c.ExpectFailure("shouldn't accept symlink, even if pointing to matching file") ft.File{"link", "content", 0644}.Check(c, s.basePath) }
func (s *EntrySuite) TestDirCheckFailureFile(c *gc.C) { ft.File{"blah", "content", 0644}.Create(c, s.basePath) c.ExpectFailure("shouldn't accept file") ft.Dir{"blah", 0644}.Check(c, s.basePath) }
func (s *EntrySuite) TestRemovedCheckFailureFile(c *gc.C) { ft.File{"some-file", "", 0644}.Create(c, s.basePath) c.ExpectFailure("should not accept file") ft.Removed{"some-file"}.Check(c, s.basePath) }
func (s *EntrySuite) TestRemovedCheckFailureDir(c *gc.C) { ft.Dir{"some-dir", 0755}.Create(c, s.basePath) c.ExpectFailure("should not accept dir") ft.Removed{"some-dir"}.Check(c, s.basePath) }
func (s *ExpectFailureFailHelper) TestFail(c *gocheck.C) { c.ExpectFailure("Bug #XYZ") }
func (s *EntrySuite) TestDirCreateFailure(c *gc.C) { os.Chmod(s.basePath, 0444) defer os.Chmod(s.basePath, 0777) c.ExpectFailure("should fail to create file") ft.Dir{"foobar", 0750}.Create(c, s.basePath) }