Skip to content

Commit

Permalink
Revert "skip test while snapshot downloader cannot handle downgrades (#…
Browse files Browse the repository at this point in the history
…3314)" (#3385)

* Revert "skip test while snapshot downloader cannot handle downgrades (#3314)"

This reverts commit a8d8fce.

* Update upgrade_test.go
  • Loading branch information
blakerouse authored Sep 8, 2023
1 parent 7675697 commit 713e562
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 9 additions & 4 deletions internal/pkg/agent/application/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ func (u *Upgrader) Upgrade(ctx context.Context, version string, sourceURI string
u.log.Errorw("Unable to clean downloads before update", "error.message", err, "downloads.path", paths.Downloads())
}

if sourceURI != "" {
sourceURI = u.settings.SourceURI
}

sourceURI = u.sourceURI(sourceURI)
archivePath, err := u.downloadArtifact(ctx, version, sourceURI, skipVerifyOverride, skipDefaultPgp, pgpBytes...)
if err != nil {
// Run the same pre-upgrade cleanup task to get rid of any newly downloaded files
Expand Down Expand Up @@ -217,6 +214,14 @@ func (u *Upgrader) Ack(ctx context.Context, acker acker.Acker) error {
return saveMarker(marker)
}

func (u *Upgrader) sourceURI(retrievedURI string) string {
if retrievedURI != "" {
return retrievedURI
}

return u.settings.SourceURI
}

func rollbackInstall(ctx context.Context, log *logger.Logger, hash string) {
os.RemoveAll(filepath.Join(paths.Data(), fmt.Sprintf("%s-%s", agentName, hash)))
_ = ChangeSymlink(ctx, log, release.ShortCommit())
Expand Down
5 changes: 1 addition & 4 deletions testing/integration/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,12 @@ func TestStandaloneUpgrade(t *testing.T) {
}
}

func TestStandaloneDowngradeWithGPGFallback(t *testing.T) {
func TestStandaloneUpgradeWithGPGFallback(t *testing.T) {
define.Require(t, define.Requirements{
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
})

t.Skip("snapshot downloader has a bug which break this test between releases: " +
"https://github.com/elastic/elastic-agent/issues/3313")

minVersion := version_8_10_0_SNAPSHOT
fromVersion, err := version.ParseVersion(define.Version())
require.NoError(t, err)
Expand Down

0 comments on commit 713e562

Please sign in to comment.