Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/build-test-push-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ jobs:
with:
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
- name: Check Source formatting
run: make fmt && if [[ $? -ne 0 ]]; then false; fi
run: |
UNFORMATTED=$(gofmt -l .)
if [ -n "$UNFORMATTED" ]; then
echo "These files are not formatted:"
echo "$UNFORMATTED"
exit 1
fi
- name: Lint source code
run: make vet && if [[ $? -ne 0 ]]; then false; fi
unit-tests:
Expand Down
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ func main() {
// as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing
// unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName
// to provide certificates, ensuring the server communicates using trusted and secure certificates.
TLSOpts: tlsOpts,
TLSOpts: tlsOpts,
FilterProvider: filters.WithAuthenticationAndAuthorization,
}

// TODO: enable https for /metrics endpoint by default
// TODO: enable https for /metrics endpoint by default
// if secureMetrics {
// // FilterProvider is used to protect the metrics endpoint with authn/authz.
// // These configurations ensure that only authorized users and service accounts
Expand Down
22 changes: 11 additions & 11 deletions pkg/splunk/enterprise/afwscheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3064,7 +3064,7 @@ func TestRunLocalScopedPlaybook(t *testing.T) {
// Test3: get installed app name passes but isAppAlreadyInstalled fails with real error (not "Could not find object")
mockPodExecReturnContexts[1].StdErr = ""
mockPodExecReturnContexts[2].StdErr = "Some other real error message" // Real error, not "Could not find object"
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 2") // Real error, not grep exit code 1
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 2") // Real error, not grep exit code 1
localInstallCtxt.sem <- struct{}{}
waiter.Add(1)
err = localInstallCtxt.runPlaybook(ctx)
Expand All @@ -3073,10 +3073,10 @@ func TestRunLocalScopedPlaybook(t *testing.T) {
}

// Test4: isAppAlreadyInstalled returns app not enabled (grep exit code 1), then install fails
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
mockPodExecReturnContexts[2].StdErr = "" // No stderr
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
mockPodExecReturnContexts[2].StdErr = "" // No stderr
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
mockPodExecReturnContexts[3].Err = fmt.Errorf("install command failed") // This causes the actual failure

localInstallCtxt.sem <- struct{}{}
Expand All @@ -3103,7 +3103,7 @@ func TestRunLocalScopedPlaybook(t *testing.T) {

// Test6: Install succeeds with stderr content (should be ignored), but cleanup fails
mockPodExecReturnContexts[3].StdErr = "Some informational message in stderr" // Stderr content should be ignored
mockPodExecReturnContexts[3].Err = nil // No actual error for install
mockPodExecReturnContexts[3].Err = nil // No actual error for install
// Keep cleanup failure from previous test setup to make overall test fail
// mockPodExecReturnContexts[4] still has error from earlier

Expand Down Expand Up @@ -3326,10 +3326,10 @@ func TestPremiumAppScopedPlaybook(t *testing.T) {

// Test4: isAppAlreadyInstalled returns app is not enabled (grep exit code 1)
// so app install will run and it should fail with real error
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
mockPodExecReturnContexts[2].StdErr = "" // No stderr
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
mockPodExecReturnContexts[2].StdErr = "" // No stderr
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
mockPodExecReturnContexts[3].Err = fmt.Errorf("install command failed") // This causes the actual failure

localInstallCtxt.sem <- struct{}{}
Expand All @@ -3341,7 +3341,7 @@ func TestPremiumAppScopedPlaybook(t *testing.T) {

// Test5: Install succeeds with stderr content (should be ignored), but post install fails
mockPodExecReturnContexts[3].StdErr = "Some informational message in stderr" // Stderr content should be ignored
mockPodExecReturnContexts[3].Err = nil // No actual error for install
mockPodExecReturnContexts[3].Err = nil // No actual error for install

localInstallCtxt.sem <- struct{}{}
waiter.Add(1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/splunk/enterprise/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ func loadFixture(t *testing.T, filename string) string {
if err != nil {
t.Fatalf("Failed to load fixture %s: %v", filename, err)
}

// Compact the JSON to match the output from json.Marshal
var compactJSON bytes.Buffer
if err := json.Compact(&compactJSON, data); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/secret/manager_secret_m4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"context"
"fmt"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

enterpriseApi "github.com/splunk/splunk-operator/api/v4"
Expand Down
2 changes: 1 addition & 1 deletion test/secret/manager_secret_s1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

enterpriseApi "github.com/splunk/splunk-operator/api/v4"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion test/secret/secret_c3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

enterpriseApi "github.com/splunk/splunk-operator/api/v4"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

"github.com/splunk/splunk-operator/test/testenv"
Expand Down
2 changes: 1 addition & 1 deletion test/secret/secret_m4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

enterpriseApi "github.com/splunk/splunk-operator/api/v4"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

"github.com/splunk/splunk-operator/test/testenv"
Expand Down
2 changes: 1 addition & 1 deletion test/secret/secret_s1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

enterpriseApi "github.com/splunk/splunk-operator/api/v4"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion test/smartstore/manager_smartstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

enterpriseApi "github.com/splunk/splunk-operator/api/v4"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

"github.com/splunk/splunk-operator/test/testenv"
Expand Down
2 changes: 1 addition & 1 deletion test/smartstore/smartstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"time"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3"
Expand Down
2 changes: 1 addition & 1 deletion test/smoke/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"context"
"fmt"

"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"

"github.com/splunk/splunk-operator/test/testenv"
Expand Down
Loading