-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add integration tests #54
Merged
Merged
Conversation
This file contains 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
adding integration tests
- improved quality code by having the OpenAPI Terraform provider rely on interfaces to set up the provider factory and resource factory. This allows for different implementations to be used such as OpenAPI v2 and make the provider evolve seamlessly without any major change in the core code of the provider by setting up the provider with any specific implementation. - created openapi v2 implementation compliant with openapi spec interfaces - provider now uses an OpenAPI Client which is able to send http requests to the appropriate resource using the resource operation configuration (e,g: security, parameters, etc) TODO: need to fix the unit tests
- SpecSecurityDefinition should contain both sec def name and apikey name which will be used in the API calls to properly send the correct header name - specV2Analyser was not being init with the openAPIDocumentURL - plugin service configuration was not being initialised with correct skipVerify value - add hostURL validation in case it's empty - various field name renaming - make APIProvider accept providerName instead of figuring out the value inside...this enables the file to be unit tested and also integration tests can be set up more easily - dep ensure --add github.com/hashicorp/logutils and github.com/davecgh/go-spew for integration tests
- fix bug in PUT cdn API where newCDN overriding previoys existing cdn will not contain the id...doing a full copy of the cdn stored in the db now updated with the info coming from the request payload (with the new fields values)
- updates to force new properties - wrong api key auth value is provided
- enable docker in the build
github.com/dikhan/terraform-provider-openapi github.com/dikhan/terraform-provider-openapi/openapi github.com/dikhan/terraform-provider-openapi/openapi/openapiutils github.com/dikhan/terraform-provider-openapi/openapi/terraformutils
…ders from auth - added unit tests
- add pointer to provider client as now the clientOpenAPI interface is used in resource factory instead - update resource factory to use clientOpenAPI interface instead - update integration test to cast to clientOpenAPI interface
…e file - added helper methods to ease the creation of spec definition property structs - create SchemaDefinitionProperty type
- fix bug where object type props where not being tagged as typeObject causing lots of weird behaviours - attach maps to payload when object types are at play - updated exaples with support for object types and status object tyeps (coming)
- use array of properties instead of map. this avoid issues where map key is set but the property name is not - this supports both status being on the root level of the schema definition and status being in nested object types - make use of idDefaultPropertyName instead of hardcoded string - fix bug where status ids were not set properly (but rather immutable field) - updated documentation - use newStatus object type property instead of former string status to validate object types as well as status fields of type object work as expected - update int tests to check on new status field instead
…itionProperty constructors
- update example swagger to not specify host. this simplifies int tests and enables the example container to communicate correctly with the API using the plugin config host set up - update terraform-provider-openapi.yaml example plugin configuration swaggercodegen swagger-url value to not use the port as mapping between external host port and internal container app https port were different and was causing connection refuse issues...hence just using https default ports which inside the container resolves correctly to port 443 and API calls are made correclty from the example container to the API swaggercodegen container - refactor int test provider to use fix host where the API is meant to be running ("https://localhost:8443/swagger.yaml"). No longer using the local file since API is supposed to serve the swagger More info at issue: #62
- PluginConfigSchemaV1 - specV2Analyser - SpecSecuritySchemes
- created specStubAuthenticator - added constructor newStubBackendConfiguration
- do not debug headers as they may contain secrets
- small refactor getServiceConfiguration removing non needed return params and rename the function to be more specific - renamed ProviderOpenAPI constructor
- unit tests shouod used their own test data instead of sharing to avoid collisions or weird behaviours
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.
Proposed changes
Major refactoring to improve code quality and increase confidence when releasing code by adding a full fledge suit of integration tests.
Type of change
What type of change does your code introduce to the provider? Please put an
x
(w/o heading/trailing white spaces)in the boxes that apply:
Checklist
Please put an
x
(w/o heading/trailing white spaces) in the boxes that apply: