mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-26 13:47:40 +00:00
Really randomize port in Swift unit-tests.
This commit is contained in:
@@ -14,11 +14,6 @@ import (
|
|||||||
"github.com/smira/aptly/files"
|
"github.com/smira/aptly/files"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
TestAddress = "localhost:5487"
|
|
||||||
AuthURL = "http://" + TestAddress + "/v1.0"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PublishedStorageSuite struct {
|
type PublishedStorageSuite struct {
|
||||||
TestAddress, AuthURL string
|
TestAddress, AuthURL string
|
||||||
srv *swifttest.SwiftServer
|
srv *swifttest.SwiftServer
|
||||||
@@ -35,14 +30,14 @@ func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
|||||||
s.TestAddress = fmt.Sprintf("localhost:%d", rand.Intn(10000)+20000)
|
s.TestAddress = fmt.Sprintf("localhost:%d", rand.Intn(10000)+20000)
|
||||||
s.AuthURL = "http://" + s.TestAddress + "/v1.0"
|
s.AuthURL = "http://" + s.TestAddress + "/v1.0"
|
||||||
|
|
||||||
s.srv, err = swifttest.NewSwiftServer(TestAddress)
|
s.srv, err = swifttest.NewSwiftServer(s.TestAddress)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
c.Assert(s.srv, NotNil)
|
c.Assert(s.srv, NotNil)
|
||||||
|
|
||||||
s.storage, err = NewPublishedStorage("swifttest", "swifttest", AuthURL, "", "", "test", "")
|
s.storage, err = NewPublishedStorage("swifttest", "swifttest", s.AuthURL, "", "", "test", "")
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
s.prefixedStorage, err = NewPublishedStorage("swifttest", "swifttest", AuthURL, "", "", "test", "lala")
|
s.prefixedStorage, err = NewPublishedStorage("swifttest", "swifttest", s.AuthURL, "", "", "test", "lala")
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
s.storage.conn.ContainerCreate("test", nil)
|
s.storage.conn.ContainerCreate("test", nil)
|
||||||
@@ -53,7 +48,7 @@ func (s *PublishedStorageSuite) TearDownTest(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *PublishedStorageSuite) TestNewPublishedStorage(c *C) {
|
func (s *PublishedStorageSuite) TestNewPublishedStorage(c *C) {
|
||||||
stor, err := NewPublishedStorage("swifttest", "swifttest", AuthURL, "", "", "", "")
|
stor, err := NewPublishedStorage("swifttest", "swifttest", s.AuthURL, "", "", "", "")
|
||||||
c.Check(stor, NotNil)
|
c.Check(stor, NotNil)
|
||||||
c.Check(err, IsNil)
|
c.Check(err, IsNil)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user