mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Fix unit-tests
Go 1.5 has different error message, randomize port number in test to avoid collisions.
This commit is contained in:
@@ -103,7 +103,7 @@ func (s *RemoteRepoSuite) TearDownTest(c *C) {
|
||||
|
||||
func (s *RemoteRepoSuite) TestInvalidURL(c *C) {
|
||||
_, err := NewRemoteRepo("s", "http://lolo%2", "squeeze", []string{"main"}, []string{}, false, false)
|
||||
c.Assert(err, ErrorMatches, ".*hexadecimal escape in host.*")
|
||||
c.Assert(err, ErrorMatches, ".*(hexadecimal escape|percent-encoded characters) in host.*")
|
||||
}
|
||||
|
||||
func (s *RemoteRepoSuite) TestFlatCreation(c *C) {
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package swift
|
||||
|
||||
import (
|
||||
"github.com/ncw/swift/swifttest"
|
||||
"github.com/smira/aptly/files"
|
||||
|
||||
"fmt"
|
||||
. "gopkg.in/check.v1"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/swift/swifttest"
|
||||
|
||||
"github.com/smira/aptly/files"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -16,6 +20,7 @@ const (
|
||||
)
|
||||
|
||||
type PublishedStorageSuite struct {
|
||||
TestAddress, AuthURL string
|
||||
srv *swifttest.SwiftServer
|
||||
storage, prefixedStorage *PublishedStorage
|
||||
}
|
||||
@@ -24,6 +29,12 @@ var _ = Suite(&PublishedStorageSuite{})
|
||||
|
||||
func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
||||
var err error
|
||||
|
||||
rand.Seed(int64(time.Now().Nanosecond()))
|
||||
|
||||
s.TestAddress = fmt.Sprintf("localhost:%d", rand.Intn(10000)+20000)
|
||||
s.AuthURL = "http://" + s.TestAddress + "/v1.0"
|
||||
|
||||
s.srv, err = swifttest.NewSwiftServer(TestAddress)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(s.srv, NotNil)
|
||||
|
||||
Reference in New Issue
Block a user