Skip to content

Commit

Permalink
Fix watcher interval.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakerouse committed Oct 13, 2023
1 parent f3965a0 commit cf8cdf1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions internal/pkg/agent/application/upgrade/error_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
)

const (
statusCheckMissesAllowed = 4 // enable 2 minute start
evaluatedPeriods = 2 // with 30s period this means we evaluate 60s of agent run
crashesAllowed = 2 // means that within 60s one restart is allowed, additional one is considered crash
statusCheckMissesAllowed = 12 // enable 2 minute start (10 second periods)
evaluatedPeriods = 6 // with 10s period this means we evaluate 60s of agent run
crashesAllowed = 2 // means that within 60s one restart is allowed, additional one is considered crash
)

// ErrAgentStatusFailed is returned when agent reports FAILED status.
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/agent/configuration/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (
defaultGracePeriodDuration = 10 * time.Minute

// interval between checks for new (upgraded) Agent returning an error status.
defaultStatusCheckInterval = 30 * time.Second
defaultStatusCheckInterval = 10 * time.Second
)

// UpgradeConfig is the configuration related to Agent upgrades.
Expand Down
26 changes: 13 additions & 13 deletions testing/integration/upgrade_rollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ func TestStandaloneUpgradeRollback(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

// Start at the build version as we want to test the retry
// logic that is in the build.
startFixture, err := define.NewFixture(t, define.Version())
require.NoError(t, err)
startVersionInfo, err := startFixture.ExecVersion(ctx)
require.NoError(t, err, "failed to get start agent build version info")

// Upgrade to an old build.
upgradeToVersion, err := upgradetest.PreviousMinor(ctx, define.Version())
// Upgrade from an old build because the new watcher from the new build will
// be ran. Otherwise the test will run the old watcher from the old build.
upgradeFromVersion, err := upgradetest.PreviousMinor(ctx, define.Version())
require.NoError(t, err)
endFixture, err := atesting.NewFixture(
startFixture, err := atesting.NewFixture(
t,
upgradeToVersion,
upgradeFromVersion,
atesting.WithFetcher(atesting.ArtifactFetcher()),
)
require.NoError(t, err)
startVersionInfo, err := startFixture.ExecVersion(ctx)
require.NoError(t, err, "failed to get start agent build version info")

// Upgrade to the build under test.
endFixture, err := define.NewFixture(t, define.Version())
require.NoError(t, err)

t.Logf("Testing Elastic Agent upgrade from %s to %s...", define.Version(), upgradeToVersion)
t.Logf("Testing Elastic Agent upgrade from %s to %s...", upgradeFromVersion, define.Version())

// Configure Agent with fast watcher configuration and also an invalid
// input when the Agent version matches the upgraded Agent version. This way
Expand All @@ -71,7 +71,7 @@ inputs:
- condition: '${agent.version.version} == "%s"'
type: invalid
id: invalid-input
`, upgradeToVersion)
`, define.Version())
return startFixture.Configure(ctx, []byte(invalidInputPolicy))
}

Expand Down

0 comments on commit cf8cdf1

Please sign in to comment.