Repository navigation
TEST: Set the variable in the configuration order test - #230
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thatCloudEndPoint_Configuration_Settingonly 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_ENDPOINTenvironment variable, then the defaulthttps://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_Settingnow creates the builder itself, sets the variable tohttps://testEnvVarEndpoint/through the builder'sgetEnvVarhook, and gives the builder to the pipeline withPipelineBuilder.addElementBuilder(pipeline/pipeline.core/src/main/java/fiftyone/pipeline/core/flowelements/PipelineBuilder.javaline 106). The configuration givesEndpointashttps://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 andExpectedEndpoint.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_ENDPOINTCloudRequestEngineBuilderTests8 run)HttpDataSetInExceptionandCloudRequestEngineLiveTests.build_Process_ReadsDeviceDataFromTheLiveServicefail 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):setEndpointadds "/" 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.setDataEndpoint,setPropertiesEndpointorsetEvidenceKeysEndpointis called (lines 248, 262 and 276), the build replaces that address with the variable or the default (lines 98, 101 and 104).