Skip to content

Commit bbe4ee0

Browse files
Merge pull request #1040 from syedriko/syedriko-ols-2118-test
OLS-2118: Support disabling the OCP index in lightspeed-operator - test
2 parents 45c09ec + 42519d0 commit bbe4ee0

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

internal/controller/ols_app_server_assets_test.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,7 @@ var _ = Describe("App server assets", func() {
834834

835835
major, minor, err := GetOpenshiftVersion(k8sClient, ctx)
836836
Expect(err).NotTo(HaveOccurred())
837-
838-
// OCP document is always there
837+
// OCP document is there unless byokRAGOnly is true
839838
ocpIndex := ReferenceIndex{
840839
ProductDocsIndexId: "ocp-product-docs-" + major + "_" + minor,
841840
ProductDocsIndexPath: "/app-root/vector_db/ocp_product_docs/" + major + "." + minor,
@@ -868,6 +867,34 @@ var _ = Describe("App server assets", func() {
868867

869868
})
870869

870+
// This test covers ByokRAGOnly == true. ByokRAGOnly == false is covered by the previous test.
871+
It("should not include the OCP docs RAG when byokRAGOnly is true", func() {
872+
cr.Spec.OLSConfig.ByokRAGOnly = true
873+
By("RAG index is added")
874+
cr.Spec.OLSConfig.RAG = []olsv1alpha1.RAGSpec{
875+
{
876+
IndexPath: "/rag/vector_db/ansible_docs/2.18",
877+
IndexID: "ansible-docs-2_18",
878+
Image: "rag-ansible-docs:2.18",
879+
},
880+
}
881+
cm, err := r.generateOLSConfigMap(context.TODO(), cr)
882+
Expect(err).NotTo(HaveOccurred())
883+
olsconfigGenerated := AppSrvConfigFile{}
884+
err = yaml.Unmarshal([]byte(cm.Data[OLSConfigFilename]), &olsconfigGenerated)
885+
Expect(err).NotTo(HaveOccurred())
886+
887+
// Testing for equality means the only RAG source is the one specified via the BYOK
888+
// mechanism above. The OCP RAG database is not included.
889+
Expect(olsconfigGenerated.OLSConfig.ReferenceContent.Indexes).To(Equal([]ReferenceIndex{
890+
{
891+
ProductDocsIndexId: "ansible-docs-2_18",
892+
ProductDocsIndexPath: RAGVolumeMountPath + "/rag-0",
893+
ProductDocsOrigin: "rag-ansible-docs:2.18",
894+
},
895+
}))
896+
})
897+
871898
It("should generate deployment with MCP server sidecar when introspectionEnabled is true", func() {
872899
createTelemetryPullSecret()
873900
defer deleteTelemetryPullSecret()

0 commit comments

Comments
 (0)