mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-15 07:00:52 +00:00
fix tests
This commit is contained in:
+2
-2
@@ -1136,7 +1136,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
release["Label"] = p.GetLabel()
|
||||
release["Suite"] = p.GetSuite()
|
||||
release["Codename"] = p.GetCodename()
|
||||
datetime_format := "Mon, 2 Jan 2006 15:04:05 MST"
|
||||
datetimeFormat := "Mon, 2 Jan 2006 15:04:05 MST"
|
||||
|
||||
publishDate := time.Now().UTC()
|
||||
if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" {
|
||||
@@ -1144,7 +1144,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
publishDate = time.Unix(sec, 0).UTC()
|
||||
}
|
||||
}
|
||||
release["Date"] = publishDate.Format(datetime_format)
|
||||
release["Date"] = publishDate.Format(datetimeFormat)
|
||||
release["Architectures"] = strings.Join(utils.StrSlicesSubstract(p.Architectures, []string{ArchitectureSource}), " ")
|
||||
if p.AcquireByHash {
|
||||
release["Acquire-By-Hash"] = "yes"
|
||||
|
||||
+4
-4
@@ -436,14 +436,14 @@ func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) {
|
||||
func (s *PublishedRepoSuite) TestPublishSourceDateEpoch(c *C) {
|
||||
// Test with SOURCE_DATE_EPOCH set
|
||||
_ = os.Setenv("SOURCE_DATE_EPOCH", "1234567890")
|
||||
defer os.Unsetenv("SOURCE_DATE_EPOCH")
|
||||
defer func() { _ = os.Unsetenv("SOURCE_DATE_EPOCH") }()
|
||||
|
||||
err := s.repo.Publish(s.packagePool, s.provider, s.factory, &NullSigner{}, nil, false, "")
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
rf, err := os.Open(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze/Release"))
|
||||
c.Assert(err, IsNil)
|
||||
defer rf.Close()
|
||||
defer func() { _ = rf.Close() }()
|
||||
|
||||
cfr := NewControlFileReader(rf, true, false)
|
||||
st, err := cfr.ReadStanza()
|
||||
@@ -456,14 +456,14 @@ func (s *PublishedRepoSuite) TestPublishSourceDateEpoch(c *C) {
|
||||
func (s *PublishedRepoSuite) TestPublishSourceDateEpochInvalid(c *C) {
|
||||
// Test with invalid SOURCE_DATE_EPOCH (should fallback to current time)
|
||||
_ = os.Setenv("SOURCE_DATE_EPOCH", "invalid")
|
||||
defer os.Unsetenv("SOURCE_DATE_EPOCH")
|
||||
defer func() { _ = os.Unsetenv("SOURCE_DATE_EPOCH") }()
|
||||
|
||||
err := s.repo2.Publish(s.packagePool, s.provider, s.factory, nil, nil, false, "")
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
rf, err := os.Open(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/Release"))
|
||||
c.Assert(err, IsNil)
|
||||
defer rf.Close()
|
||||
defer func() { _ = rf.Close() }()
|
||||
|
||||
cfr := NewControlFileReader(rf, true, false)
|
||||
st, err := cfr.ReadStanza()
|
||||
|
||||
@@ -20,7 +20,7 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatalf("Error opening DB %q: %s", dbPath, err)
|
||||
}
|
||||
defer db.Close()
|
||||
defer func() { _ = db.Close() }()
|
||||
|
||||
keys := db.KeysByPrefix([]byte(prefix))
|
||||
if len(keys) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user