-
Notifications
You must be signed in to change notification settings - Fork 176
[Integration Test] Ensure that upgrading a FIPS-capable Agent results in a FIPS-capable Agent #7804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ycombinator
merged 44 commits into
elastic:main
from
ycombinator:it-upgrade-fips-to-fips
Jun 13, 2025
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
b0a52e2
Adding skeleton for FIPS-to-FIPS upgrade test
ycombinator 0e69b61
Expose FIPS compliance in GRPC client Version call response
ycombinator a95ecd2
Test upgrade from FIPS to FIPS artifact
ycombinator 11196de
Change assert to require
ycombinator 53105cb
Add postWatcherSuccessHook to upgrade test
ycombinator 539b4ec
Refactor standalone upgrade test to take upgradeOpts
ycombinator 7cdebd1
Fix up FIPS upgrade test to use postWatcherSuccessHook to test FIPS c…
ycombinator 07acc3f
Add version constraint to test
ycombinator 40c1c50
s/compliant/capable/
ycombinator 845a980
s/compliant/capable/
ycombinator 513ab42
Append -fips to artifact name if current release of Agent is FIPS-cap…
ycombinator 1231b9e
Enable FIPS-capable to FIPS-capable Agent upgrades
ycombinator 40876e8
Running mage fmt
ycombinator 1af3dc5
Adding test to ensure FIPS-capable Agent cannot be upgraded to non-FI…
ycombinator 7af341a
Adding return value
ycombinator df9d1dd
Fixing function calls
ycombinator 9acd072
Remove post-upgrade success hook since we expect upgrade to fail
ycombinator 731856d
Add minimum FIPS version check for start version
ycombinator ed1f419
Simplify upgradeOpts initialization
ycombinator 71a628c
Add version equality comparison method
ycombinator 837ab5b
Fix version checks in tests
ycombinator 1dd1574
Refactor version check into own helper function
ycombinator d875271
Fixing args
ycombinator 9b32e02
No need to pass testing.T
ycombinator 98de896
Remove redundant test case
ycombinator f65f937
Restrict FIPS integration tests to Linux
ycombinator 9697e04
Add Fleet-managed Agent FIPS upgrade test
ycombinator a163575
Remove integration test trying to upgrade FIPS to non-FIPS
ycombinator a8fbb18
Fix type of argument
ycombinator ed656cf
Refactoring: extract common logic into helper function
ycombinator ab9df22
Remove old code
ycombinator 06cdd21
Require no error
ycombinator fb4f52f
Fixing syntax errors
ycombinator 39451df
Define tests as needing a FIPS environment
ycombinator 19db0a9
FIPS upgrade tests should only run on Linux
ycombinator 6529eec
FIPS upgrade tests should start with FIPS-capable version
ycombinator bb516df
Fixing comment + skip message
ycombinator 7a053e9
Fix syntax errors
ycombinator a14d574
Removing TestStandaloneUpgradeFIPStoFIPS test
ycombinator 443d3e3
Removing TestFleetManagedUpgradePrivilegedFIPS test
ycombinator 5713cda
Add back accidentally-deleted function
ycombinator 531c3f3
Combine less and equal unit tests
ycombinator d770d77
Hash replaceToken only if its non-empty
ycombinator b99a92f
Use startFixture
ycombinator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
internal/pkg/agent/application/upgrade/artifact/artifact_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License 2.0; | ||
// you may not use this file except in compliance with the Elastic License 2.0. | ||
|
||
package artifact | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
agtversion "github.com/elastic/elastic-agent/pkg/version" | ||
) | ||
|
||
func TestGetArtifactName(t *testing.T) { | ||
version, err := agtversion.ParseVersion("9.1.0") | ||
require.NoError(t, err) | ||
|
||
tests := map[string]struct { | ||
a Artifact | ||
version agtversion.ParsedSemVer | ||
operatingSystem string | ||
arch string | ||
expectedName string | ||
expectedErr string | ||
}{ | ||
"no_fips": { | ||
a: Artifact{Cmd: "elastic-agent"}, | ||
version: *version, | ||
operatingSystem: "linux", | ||
arch: "arm64", | ||
expectedName: "elastic-agent-9.1.0-linux-arm64.tar.gz", | ||
}, | ||
"fips": { | ||
a: Artifact{Cmd: "elastic-agent-fips"}, | ||
version: *version, | ||
operatingSystem: "linux", | ||
arch: "arm64", | ||
expectedName: "elastic-agent-fips-9.1.0-linux-arm64.tar.gz", | ||
}, | ||
} | ||
|
||
for name, test := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
artifactName, err := GetArtifactName(test.a, test.version, test.operatingSystem, test.arch) | ||
if test.expectedErr == "" { | ||
require.NoError(t, err) | ||
require.Equal(t, test.expectedName, artifactName) | ||
} else { | ||
require.Empty(t, artifactName) | ||
require.Equal(t, test.expectedErr, err.Error()) | ||
} | ||
}) | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: not used anymore in these tests, also
version
,operatingSystem
andarch
do not differ in the below testcases, so might be able to tidy this up a bit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#8559