MCPcopy Create free account
hub / github.com/aptly-dev/aptly / SetUpTest

Method SetUpTest

gcs/public_test.go:29–51  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

27var _ = Suite(&PublishedStorageSuite{})
28
29func (s *PublishedStorageSuite) SetUpTest(c *C) {
30 var err error
31 s.srv, err = fakestorage.NewServerWithOptions(fakestorage.Options{
32 Scheme: "http",
33 Host: "127.0.0.1",
34 })
35 c.Assert(err, IsNil)
36 c.Assert(s.srv, NotNil)
37
38 s.srv.CreateBucketWithOpts(fakestorage.CreateBucketOpts{Name: "test"})
39
40 // The cloud.google.com/go/storage client honors STORAGE_EMULATOR_HOST and
41 // will route all requests (including media uploads) to the fake server.
42 s.prevEmulatorHost, s.prevEmulatorHostSet = os.LookupEnv("STORAGE_EMULATOR_HOST")
43 c.Assert(os.Setenv("STORAGE_EMULATOR_HOST", s.srv.URL()), IsNil)
44
45 s.storage, err = NewPublishedStorage("test", "", "", "", "", "", "", "", "", false, false)
46 c.Assert(err, IsNil)
47 s.prefixedStorage, err = NewPublishedStorage("test", "lala", "", "", "", "", "", "", "", false, false)
48 c.Assert(err, IsNil)
49 s.noSuchBucketStorage, err = NewPublishedStorage("no-bucket", "", "", "", "", "", "", "", "", false, false)
50 c.Assert(err, IsNil)
51}
52
53func (s *PublishedStorageSuite) TearDownTest(c *C) {
54 if s.prevEmulatorHostSet {

Callers

nothing calls this directly

Calls 2

URLMethod · 0.80
NewPublishedStorageFunction · 0.70

Tested by

no test coverage detected