Skip to content

Commit

Permalink
[OSSM-6266] Add reproducer for error after validationMessages=true (#682
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mkralik3 authored Apr 22, 2024
1 parent be019bd commit a43f5ff
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/tests/non-dependant/bug_multiple_smcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func TestSMCPMultiple(t *testing.T) {
NewTest(t).Id("T36").Groups(Full, ARM).Run(func(t TestHelper) {
t.Log("This test verifies whether the operator only reconciles one SMCP when two exist in a namespace")
t.Log("See https://issues.redhat.com/browse/OSSM-2189")
t.Log("See https://issues.redhat.com/browse/OSSM-2419")

smcp1 := ossm.DefaultSMCP().WithName("smcp1")
smcp2 := ossm.DefaultSMCP().WithName("smcp2")
Expand Down
81 changes: 80 additions & 1 deletion pkg/tests/ossm/bug_istiopods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@ import (
"fmt"
"strings"
"testing"
"time"

"github.com/maistra/maistra-test-tool/pkg/util"
"github.com/maistra/maistra-test-tool/pkg/util/check/assert"
"github.com/maistra/maistra-test-tool/pkg/util/oc"
"github.com/maistra/maistra-test-tool/pkg/util/pod"
"github.com/maistra/maistra-test-tool/pkg/util/retry"
"github.com/maistra/maistra-test-tool/pkg/util/template"
. "github.com/maistra/maistra-test-tool/pkg/util/test"
)

// TestIstiodPodFailsAfterRestarts tests that Istio pod get stuck with probes failure after restart. Jira ticket bug: https://issues.redhat.com/browse/OSSM-2434
func TestIstiodPodFailsAfterRestarts(t *testing.T) {
NewTest(t).Id("T35").Groups(Full, Disconnected, ARM).Run(func(t TestHelper) {
t.Log("Verify that Istio pod not get stuck with probes failure after restart")
t.Log("Reference: https://issues.redhat.com/browse/OSSM-2434")
namespaces := util.GenerateStrings("test-", 50)

t.Cleanup(func() {
Expand All @@ -51,6 +56,54 @@ func TestIstiodPodFailsAfterRestarts(t *testing.T) {
})
}

func TestIstiodPodFailsWithValidationMessages(t *testing.T) {
NewTest(t).Groups(Full, Disconnected, ARM).Run(func(t TestHelper) {
t.Log("Verify that Istio pod is not failing when validationMessages was enabled")

oc.RecreateNamespace(t, meshNamespace)
oc.ReplaceOrApplyString(t, meshNamespace, template.Run(t, validationMessagesSMCP, DefaultSMCP()))
t.Cleanup(func() {
oc.RecreateNamespace(t, meshNamespace)
})

istiodPod := pod.MatchingSelector("app=istiod", meshNamespace)
oc.WaitPodRunning(t, istiodPod)
retry.UntilSuccessWithOptions(t, retry.Options().MaxAttempts(10), func(t TestHelper) {
oc.LogsFromPods(t, meshNamespace, "app=istiod", assert.OutputContains(
"successfully acquired lease istio-system/istio-analyze-leader",
"Successfully acquired lease for analyzer in istiod pod",
"Expected to acquire lease for analyzer in istiod pod, but was not",
),
)
})
time.Sleep(time.Second * 5) //wait 5 seconds to make sure that the errors appear after the lease is acquired

t.Log("Verify that Istiod pod doesn't contain SIGSEGV when validationMessages was enabled")
t.Log("Reference: https://issues.redhat.com/browse/OSSM-6177")
oc.Logs(t,
istiodPod,
"discovery",
assert.OutputDoesNotContain(
"SIGSEGV: segmentation violation",
"Found no SIGSEGV",
"Expected to find no SIGSEGV, but got some SIGSEGV",
),
)

t.Log("Verify that istiod doesn't contain any cannot list resource error when validationMessages was enabled")
t.Log("Reference: https://issues.redhat.com/browse/OSSM-6289")
oc.Logs(t,
istiodPod,
"discovery",
assert.OutputDoesNotContain(
"watch error in cluster : failed to list",
"Found no `cannot list resource` error",
"Expected to find no `cannot list resource` error, but got some error",
),
)
})
}

func createSMMRManifest(namespaces ...string) string {
return fmt.Sprintf(`
apiVersion: maistra.io/v1
Expand All @@ -64,3 +117,29 @@ spec:
- bar
- legacy%s`, strings.Join(namespaces, "\n - "))
}

const (
validationMessagesSMCP = `
apiVersion: maistra.io/v2
kind: ServiceMeshControlPlane
metadata:
name: {{ .Name }}
spec:
version: {{ .Version }}
general:
validationMessages: true
tracing:
type: None
addons:
grafana:
enabled: false
kiali:
enabled: false
prometheus:
enabled: false
{{ if .Rosa }}
security:
identity:
type: ThirdParty
{{ end }}`
)

0 comments on commit a43f5ff

Please sign in to comment.