Skip to content

Commit 28cd68c

Browse files
test(fips): validate keystore cmd is not enabled in fips mode (#15707) (#15723)
update test to validate fips behaviour (cherry picked from commit e3d61f4) Co-authored-by: kruskall <[email protected]>
1 parent 5fcb8f4 commit 28cd68c

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// or more contributor license agreements. Licensed under the Elastic License 2.0;
33
// you may not use this file except in compliance with the Elastic License 2.0.
44

5+
//go:build requirefips
6+
57
package main
68

79
import (
@@ -23,7 +25,6 @@ func TestSubCommands(t *testing.T) {
2325

2426
assert.ElementsMatch(t, []string{
2527
"export",
26-
"keystore",
2728
"run",
2829
"test",
2930
"version",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License 2.0;
3+
// you may not use this file except in compliance with the Elastic License 2.0.
4+
5+
//go:build !requirefips
6+
7+
package main
8+
9+
import (
10+
"testing"
11+
12+
"github.com/stretchr/testify/assert"
13+
14+
"github.com/elastic/apm-server/internal/beatcmd"
15+
)
16+
17+
func TestSubCommands(t *testing.T) {
18+
rootCmd := newXPackRootCommand(func(beatcmd.RunnerParams) (beatcmd.Runner, error) {
19+
panic("unexpected call")
20+
})
21+
var commands []string
22+
for _, cmd := range rootCmd.Commands() {
23+
commands = append(commands, cmd.Name())
24+
}
25+
26+
assert.ElementsMatch(t, []string{
27+
"export",
28+
"keystore",
29+
"run",
30+
"test",
31+
"version",
32+
}, commands)
33+
}

0 commit comments

Comments
 (0)