@@ -13,6 +13,7 @@ import (
13
13
14
14
atesting "github.com/elastic/elastic-agent/pkg/testing"
15
15
"github.com/elastic/elastic-agent/pkg/testing/define"
16
+ "github.com/elastic/elastic-agent/testing/upgradetest"
16
17
)
17
18
18
19
// This file contains upgrade tests that pertain to FIPS-compliant Agent artifacts.
@@ -27,16 +28,27 @@ func TestStandaloneUpgradeFIPStoFIPS(t *testing.T) {
27
28
})
28
29
29
30
// Start with a FIPS-compliant Agent artifact
30
- // TODO: introduce FIPS option for artifact fetcher
31
+ fipsArtifactFetcher := atesting . ArtifactFetcher ( atesting . WithArtifactFIPSOnly ())
31
32
startFixture , err := atesting .NewFixture (
32
33
t ,
33
34
startVersion .String (),
34
- atesting .WithFetcher (atesting . ArtifactFetcher () ),
35
+ atesting .WithFetcher (fipsArtifactFetcher ),
35
36
)
36
37
require .NoError (t , err , "error creating previous agent fixture" )
37
38
38
39
// Upgrade to newer version of Agent
40
+ endFixture , err := define .NewFixtureFromLocalBuild (t , endVersion )
41
+ require .NoError (t , err )
42
+
43
+ err = upgradetest .PerformUpgrade (ctx , startFixture , endFixture , t , upgradetest .WithUnprivileged (unprivileged ))
44
+ assert .NoError (t , err )
39
45
40
46
// Check that new (post-upgrade) Agent is also FIPS-compliant
41
- // TODO: check if Agent status contains information about FIPS mode
47
+ client := endFixture .Client ()
48
+ err = client .Connect (ctx )
49
+ require .NoError (t , err )
50
+
51
+ ver , err := client .Version (ctx )
52
+ require .NoError (t , err )
53
+ require .True (t , ver .Fips )
42
54
}
0 commit comments