feat(e2e): add environment-agent deploy and embedded storage registration tests (FLPATH-4803) - #45
Conversation
PR Summary by QodoAdd environment-agent and Kubernetes storage E2E coverage
AI Description
Diagram
High-Level Assessment
Files changed (15)
|
Code Review by Qodo
1.
|
57bab78 to
2841832
Compare
…s (FLPATH-4434, FLPATH-4803) Add standalone storage SP E2E (API, NATS status, cluster checks) and wire environment-agent deploy with embedded storage registration validation. Deploy: --environment-agent provider, compose override on port 8090, pull_policy missing for local agent builds, .dcm-e2e.env exports. Tests: embedded storage at embedded://storage via agent /providers; keep DCM_NATS_URL in run-e2e.sh --help for CI validate-scripts. Assisted-by: Cursor Signed-off-by: igavra <igavra@redhat.com>
495ec9d to
86f0807
Compare
| CLI_REQUIREMENT="oc-or-kubectl" | ||
|
|
||
| # Reuse storage namespace flag/env for embedded SP_K8S_NAMESPACE. | ||
| NAMESPACE_FLAG="k8s-storage-namespace" |
There was a problem hiding this comment.
nit: what do you think to prefix this variable with the K8S_STORAGE_SP_ so that it's clear these are specific for the SP and not required by the environment agent?
| Expect(err).NotTo(HaveOccurred()) | ||
| Expect(resp.StatusCode).To(Equal(http.StatusOK)) | ||
|
|
||
| var body map[string]interface{} |
There was a problem hiding this comment.
do we already have a defined structure to use instead of unstructured data?
| var body map[string]interface{} | ||
| decodeJSON(resp, &body) | ||
| Expect(body["status"]).To(Equal("healthy")) | ||
| Expect(body).To(HaveKey("uptime")) |
There was a problem hiding this comment.
is there an expected value to check for all 3 fields?
| name := uniqueName("e2e-vol") | ||
| body := createTestVolume(volumeSpec(name, defaultTestCapacity)) | ||
|
|
||
| id := body["id"].(string) |
There was a problem hiding this comment.
any reason why not use structured data?
|
|
||
| var body map[string]interface{} | ||
| decodeJSON(resp, &body) | ||
| Expect(body).To(HaveKey("id")) |
There was a problem hiding this comment.
if you used structured data, you would not need to check this. Perhaps check that the field has a value that matches the format from the rest call?
| ExpectWithOffset(1, err).NotTo(HaveOccurred(), "failed to get PVC %s", name) | ||
|
|
||
| var pvc map[string]interface{} | ||
| ExpectWithOffset(1, json.Unmarshal([]byte(out), &pvc)).To(Succeed()) |
There was a problem hiding this comment.
you're not validating the pvc, just that there is one. You should also validate that the PVC is ready.
|
|
||
| // runStorageKubectl executes kubectl/oc in the storage SP namespace. | ||
| func runStorageKubectl(args ...string) (string, error) { | ||
| fullArgs := append([]string{"-n", storageSPNamespace}, args...) |
There was a problem hiding this comment.
why cli and not using the kubernetes go client?
|
|
||
| // applyStorageManifest applies a Kubernetes manifest in the storage SP namespace. | ||
| func applyStorageManifest(manifest string) error { | ||
| cmd := exec.Command(kubectlBin, "-n", storageSPNamespace, "apply", "-f", "-") |
There was a problem hiding this comment.
same here: why cli and not the kubernetes go client bindings?
|
|
||
| // doEnvironmentAgentRequest sends a request to the environment agent API. | ||
| func doEnvironmentAgentRequest(method, path string, body string) (*http.Response, error) { | ||
| url := environmentAgentBaseURL + path |
There was a problem hiding this comment.
why not use the environment agent bindings? using pure http client is not testing the env agent real path. And it makes this tests brittle the moment the rest api changes (new fields, path, etc..), which should not make these tests fail
|
|
||
| # Export SP URLs when providers are enabled. | ||
| if [[ "${ENABLE_CONTAINER_SP}" == "true" ]] || [[ "${ENABLE_ACM_CLUSTER_SP}" == "true" ]]; then | ||
| if [[ "${ENABLE_CONTAINER_SP}" == "true" ]] || [[ "${ENABLE_STORAGE_SP}" == "true" ]] || [[ "${ENABLE_ACM_CLUSTER_SP}" == "true" ]]; then |
There was a problem hiding this comment.
are we planning on creating lanes for each SP so that they run isolated?
And dcm-project/environment-agent#31
Wire environment-agent with embedded k8s storage SP into the utilities E2E stack
so registration can be validated without a standalone storage SP container.
Deploy:
AGENT_EMBEDDED_SPS=storage, DCM_REGISTRATION_URL without /api/v1alpha1 path)
exports (DCM_ENVIRONMENT_AGENT_URL, K8S_STORAGE_SP_REGISTERED_ENDPOINT)
by Quay while embedded storage is not yet on main
Tests:
tests work with --environment-agent only (no :8089)
Docs: README, CLAUDE.md, e2e-tests.mdc