Skip to content

Commit 35ee73e

Browse files
committed
Compressing assets.go olsconfig generation, moving flakeattempts to test level and fixing linting
1 parent 072dcfb commit 35ee73e

6 files changed

Lines changed: 249 additions & 287 deletions

File tree

test/e2e/all_features_test.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ const (
4848
// - Tests ALL OLSConfig features in a single comprehensive configuration
4949
// - Labeled "AllFeatures" to exclude from standard make test-e2e runs
5050
// - Combines features from all other E2E tests plus new features not tested elsewhere
51-
// - FlakeAttempts(5) handles transient query timing and network issues
51+
// - Each It block has FlakeAttempts(5) to retry only failing tests, not entire suite
5252
// - Longer timeout (3h) due to complexity of setup and comprehensive testing
53-
var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAttempts(5), func() {
53+
var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), func() {
5454
var env *OLSTestEnvironment
5555
var err error
5656
var client *Client
@@ -463,7 +463,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
463463
})
464464

465465
// Test 1: Deployment Validation
466-
It("should deploy all components successfully", func() {
466+
It("should deploy all components successfully", FlakeAttempts(5), func() {
467467
By("Verifying app server deployment with 2 replicas")
468468
appDeployment := &appsv1.Deployment{
469469
ObjectMeta: metav1.ObjectMeta{
@@ -510,7 +510,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
510510
})
511511

512512
// Test 2: Configuration Validation
513-
It("should have all features configured in the CR", func() {
513+
It("should have all features configured in the CR", FlakeAttempts(5), func() {
514514
By("Retrieving the OLSConfig CR")
515515
cr := &olsv1alpha1.OLSConfig{
516516
ObjectMeta: metav1.ObjectMeta{
@@ -554,7 +554,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
554554
})
555555

556556
// Test 3: ConfigMap Validation
557-
It("should have all features in the olsconfig ConfigMap", func() {
557+
It("should have all features in the olsconfig ConfigMap", FlakeAttempts(5), func() {
558558
By("Retrieving the olsconfig ConfigMap")
559559
configMap := &corev1.ConfigMap{
560560
ObjectMeta: metav1.ObjectMeta{
@@ -585,7 +585,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
585585
})
586586

587587
// Test 4: TLS and Service Activation
588-
It("should have TLS properly configured", func() {
588+
It("should have TLS properly configured", FlakeAttempts(5), func() {
589589
By("Verifying TLS secret exists")
590590
tlsSecret := &corev1.Secret{
591591
ObjectMeta: metav1.ObjectMeta{
@@ -611,22 +611,22 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
611611
})
612612

613613
// Test 5: Basic Query Functionality
614-
It("should handle basic queries successfully", func() {
614+
It("should handle basic queries successfully", FlakeAttempts(5), func() {
615615
By("Making a basic query request")
616616
reqBody := []byte(`{"query": "what is OpenShift?"}`)
617617
resp, body, err := TestHTTPSQueryEndpoint(env, secret, reqBody)
618-
CheckErrorAndRestartPortForwardingTestEnvironment(env, err)
618+
CheckEOFAndRestartPortForwarding(env, err)
619619
Expect(err).NotTo(HaveOccurred())
620620
Expect(resp.StatusCode).To(Equal(http.StatusOK))
621621
Expect(body).NotTo(BeEmpty())
622622
})
623623

624624
// Test 6: BYOK RAG Query
625-
It("should return BYOK content and respect byokRAGOnly mode", func() {
625+
It("should return BYOK content and respect byokRAGOnly mode", FlakeAttempts(5), func() {
626626
By("Making a query that should hit BYOK RAG index")
627627
reqBody := []byte(`{"query": "what CPU architectures are supported by assisted installer?"}`)
628628
resp, body, err := TestHTTPSQueryEndpoint(env, secret, reqBody)
629-
CheckErrorAndRestartPortForwardingTestEnvironment(env, err)
629+
CheckEOFAndRestartPortForwarding(env, err)
630630
Expect(err).NotTo(HaveOccurred())
631631
Expect(resp.StatusCode).To(Equal(http.StatusOK))
632632

@@ -646,7 +646,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
646646
})
647647

648648
// Test 7: MCP Server Sidecar
649-
It("should have openshift-mcp-server sidecar container", func() {
649+
It("should have openshift-mcp-server sidecar container", FlakeAttempts(5), func() {
650650
By("Verifying openshift-mcp-server container is present in app deployment")
651651
appDeployment := &appsv1.Deployment{
652652
ObjectMeta: metav1.ObjectMeta{
@@ -669,18 +669,18 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
669669
})
670670

671671
// Test 8: Proxy Functionality
672-
It("should route queries through the proxy", func() {
672+
It("should route queries through the proxy", FlakeAttempts(5), func() {
673673
By("Making a query through the proxy")
674674
reqBody := []byte(`{"query": "what is Kubernetes?"}`)
675675
resp, body, err := TestHTTPSQueryEndpoint(env, secret, reqBody)
676-
CheckErrorAndRestartPortForwardingTestEnvironment(env, err)
676+
CheckEOFAndRestartPortForwarding(env, err)
677677
Expect(err).NotTo(HaveOccurred())
678678
Expect(resp.StatusCode).To(Equal(http.StatusOK))
679679
Expect(body).NotTo(BeEmpty())
680680
})
681681

682682
// Test 9: Database Persistence
683-
It("should persist conversations in postgres with correct configuration", func() {
683+
It("should persist conversations in postgres with correct configuration", FlakeAttempts(5), func() {
684684
By("Verifying PVC exists with correct size")
685685
pvc := &corev1.PersistentVolumeClaim{
686686
ObjectMeta: metav1.ObjectMeta{
@@ -720,7 +720,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
720720
})
721721

722722
// Test 10: Resource Limits Validation
723-
It("should have correct resource limits for all containers", func() {
723+
It("should have correct resource limits for all containers", FlakeAttempts(5), func() {
724724
By("Verifying API container resource limits")
725725
appDeployment := &appsv1.Deployment{
726726
ObjectMeta: metav1.ObjectMeta{
@@ -763,7 +763,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
763763
})
764764

765765
// Test 11: Custom System Prompt
766-
It("should use the custom system prompt", func() {
766+
It("should use the custom system prompt", FlakeAttempts(5), func() {
767767
By("Verifying custom prompt in ConfigMap")
768768
configMap := &corev1.ConfigMap{
769769
ObjectMeta: metav1.ObjectMeta{
@@ -779,7 +779,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
779779
})
780780

781781
// Test 12: Query Filters
782-
It("should have query filters configured and functioning", func() {
782+
It("should have query filters configured and functioning", FlakeAttempts(5), func() {
783783
By("Verifying query filters in ConfigMap")
784784
configMap := &corev1.ConfigMap{
785785
ObjectMeta: metav1.ObjectMeta{
@@ -802,7 +802,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
802802
By("Sending query with filtered term to verify filter functionality")
803803
reqBody := []byte(`{"query": "what is oldterm in Kubernetes?"}`)
804804
resp, body, err := TestHTTPSQueryEndpoint(env, secret, reqBody)
805-
CheckErrorAndRestartPortForwardingTestEnvironment(env, err)
805+
CheckEOFAndRestartPortForwarding(env, err)
806806
Expect(err).NotTo(HaveOccurred())
807807
Expect(resp.StatusCode).To(Equal(http.StatusOK))
808808
Expect(body).NotTo(BeEmpty())
@@ -845,14 +845,14 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
845845
})
846846

847847
// Test 12b: Query Filters - Edge Cases
848-
It("should filter multiple occurrences of the term in a single query", func() {
848+
It("should filter multiple occurrences of the term in a single query", FlakeAttempts(5), func() {
849849
// Record the time before sending the query
850850
queryStartTime := time.Now()
851851

852852
By("Sending query with multiple occurrences of filtered term")
853853
reqBody := []byte(`{"query": "How does oldterm differ from oldterm in production? Is oldterm configuration important?"}`)
854854
resp, body, err := TestHTTPSQueryEndpoint(env, secret, reqBody)
855-
CheckErrorAndRestartPortForwardingTestEnvironment(env, err)
855+
CheckEOFAndRestartPortForwarding(env, err)
856856
Expect(err).NotTo(HaveOccurred())
857857

858858
// Log error details if we get a 500 status
@@ -889,7 +889,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
889889
})
890890

891891
// Test 13: Multi-Provider Configuration
892-
It("should have multiple providers and models configured", func() {
892+
It("should have multiple providers and models configured", FlakeAttempts(5), func() {
893893
By("Retrieving the OLSConfig CR")
894894
cr := &olsv1alpha1.OLSConfig{
895895
ObjectMeta: metav1.ObjectMeta{
@@ -911,7 +911,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
911911
})
912912

913913
// Test 14: User Data Collection Settings
914-
It("should have user data collection settings configured correctly", func() {
914+
It("should have user data collection settings configured correctly", FlakeAttempts(5), func() {
915915
By("Verifying user data collection in ConfigMap")
916916
configMap := &corev1.ConfigMap{
917917
ObjectMeta: metav1.ObjectMeta{
@@ -937,7 +937,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
937937
// Make a query to get a valid conversation_id for feedback testing
938938
queryReqBody := []byte(`{"query": "what is OpenShift?"}`)
939939
queryResp, queryBody, err := TestHTTPSQueryEndpoint(env, secret, queryReqBody)
940-
CheckErrorAndRestartPortForwardingTestEnvironment(env, err)
940+
CheckEOFAndRestartPortForwarding(env, err)
941941
Expect(err).NotTo(HaveOccurred())
942942
Expect(queryResp.StatusCode).To(Equal(http.StatusOK))
943943

@@ -949,15 +949,15 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
949949
Expect(conversationID).NotTo(BeEmpty())
950950

951951
// Should fail because feedback is disabled
952-
feedbackReqBody := []byte(fmt.Sprintf(`{
952+
feedbackReqBody := fmt.Appendf(nil, `{
953953
"conversation_id": "%s",
954954
"user_question": "what is OpenShift?",
955955
"llm_response": "OpenShift is a container platform",
956956
"sentiment": 1
957-
}`, conversationID))
957+
}`, conversationID)
958958

959959
feedbackResp, err := httpsClient.PostJson("/v1/feedback", feedbackReqBody, authHeader)
960-
CheckErrorAndRestartPortForwardingTestEnvironment(env, err)
960+
CheckEOFAndRestartPortForwarding(env, err)
961961
Expect(err).NotTo(HaveOccurred())
962962

963963
// Exact status code may vary (400, 403, or 404) depending on implementation
@@ -969,7 +969,7 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), FlakeAtt
969969
})
970970

971971
// Test 15: Additional CA Certificates
972-
It("should have additional CA certificates mounted", func() {
972+
It("should have additional CA certificates mounted", FlakeAttempts(5), func() {
973973
By("Verifying additional CA volume in app deployment")
974974
appDeployment := &appsv1.Deployment{
975975
ObjectMeta: metav1.ObjectMeta{

0 commit comments

Comments
 (0)