Skip to content

TEST: Set the variable in the configuration order test - #230

Merged
jwrosewell merged 2 commits into
rcfrom
fix/cloud-endpoint-config-test
Nov 23, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
fix/cloud-endpoint-config-test

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#229 made the cloud request engine tests expect the address the endpoint order gives, so the release pull request #190 no longer fails when CI sets _51DEGREES_CLOUD_ENDPOINT. A review of #229 found that CloudEndPoint_Configuration_Setting only proved configuration over the variable where the outer environment happened to set the variable. With the variable unset, as in a local run, it proved only configuration over the default. #229 merged before this was fixed, so the fix follows here.

The order every cloud request engine follows is an address given in code or configuration first, then the _51DEGREES_CLOUD_ENDPOINT environment variable, then the default https://cloud.51degrees.com/api/v4/ when both are blank.

What changed (one test file)

pipeline/pipeline.cloudrequestengine/src/test/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilderTests.java:

  • CloudEndPoint_Configuration_Setting now creates the builder itself, sets the variable to https://testEnvVarEndpoint/ through the builder's getEnvVar hook, and gives the builder to the pipeline with PipelineBuilder.addElementBuilder (pipeline/pipeline.core/src/main/java/fiftyone/pipeline/core/flowelements/PipelineBuilder.java line 106). The configuration gives Endpoint as https://testEndpoint/. The test checks the builder kept that address and that every request went there, so it proves configuration over the variable wherever it runs.
  • CloudEndPoint_Matches_Expected_For_Each_Variable (new) sets the variable through the same hook to a missing value, an empty one, an address without a trailing slash and an address with one and checks that the engine and ExpectedEndpoint.root(value) agree for each. Before, the helper and the engine were compared only for the one value the environment gave.

The engine is not changed.

How it was checked

Windows, JDK 21, Maven wrapper, offline, building the reactor from source:

./mvnw -o -pl pipeline/pipeline.cloudrequestengine -am test "-Dtest=fiftyone.pipeline.cloudrequestengine.**" -Dsurefire.failIfNoSpecifiedTests=false

_51DEGREES_CLOUD_ENDPOINT Result
unset 170 run, 0 failures, 0 errors (CloudRequestEngineBuilderTests 8 run)
another cloud address without a trailing slash 170 run, 0 failures, 0 errors
an address that does not resolve 168 pass. HttpDataSetInException and CloudRequestEngineLiveTests.build_Process_ReadsDeviceDataFromTheLiveService fail because both call the real service at the variable's address. The new and changed tests pass.

Not run here: JDK 8, 11 and 17, and the Linux and macOS runners, which CI covers.

Outstanding

The engine's own order differs from the rule in these places, recorded in #229 and not changed here (pipeline/pipeline.cloudrequestengine/src/main/java/fiftyone/pipeline/cloudrequestengine/flowelements/CloudRequestEngineBuilder.java):

  1. setEndpoint adds "/" before storing the address (lines 227 to 230), so a blank address from code or configuration is stored as "/" and never falls through to the variable or the default. setEndpoint(null) throws at line 227.
  2. If only setDataEndpoint, setPropertiesEndpoint or setEvidenceKeysEndpoint is called (lines 248, 262 and 276), the build replaces that address with the variable or the default (lines 98, 101 and 104).
  3. The variable counts as blank only when it is empty (line 100), so a value of spaces is used as an address.

CloudEndPoint_Configuration_Setting now gives the pipeline a builder whose variable is set through the getEnvVar hook, so the test proves configuration over the variable wherever it runs, not only where the outer environment sets the variable. Add a test that the engine and ExpectedEndpoint agree for a missing, empty, unslashed and slashed variable.
@jwrosewell
jwrosewell marked this pull request as ready for review November 23, 2026 09:41
@jwrosewell
jwrosewell merged commit f92161d into rc Nov 23, 2026
5 checks passed
@jwrosewell
jwrosewell deleted the fix/cloud-endpoint-config-test branch November 23, 2026 09:41
@jwrosewell jwrosewell mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant