-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provider Unit Tests (Provider Lifecycle) (#2768)
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md) for Pulumi's contribution guidelines. Help us merge your changes more quickly by adding more details such as labels, milestones, and reviewers.--> ### Proposed changes This PR implements a suite of unit tests for the provider implementation code in `provider/pkg/provider/provider.go`. Unlike the test suites in `tests/`, this suite uses a mock Kubernetes client and executes the provider code directly. This PR focuses on the provider lifecycle (e.g. plugin info and provider configuration): - [x] Suite - [x] RPC:CheckConfig - [x] Strict Mode - [x] Yaml Rendering Mode - [x] RPC:DiffConfig - [x] Kubeconfig Parsing - [x] Cluster Change Detection - [x] RPC:Configure - [x] Secrets Support - [x] Connectivity - [x] RPC:GetPluginInfo - [x] RPC:GetSchema - [x] RPC:GetMapping - [x] RPC:Cancel In follow-up PR(s), tests will be developed for the resource lifecycle (eg. `Check`, `Diff`, `Read`, `Create`, `Update`, `Delete`), and for invokes (`Invoke`, `StreamInvoke`). ### Changes to Implementation Code Some minor refactoring was necessary to make it possible to substitute fake Kubernetes clients. - the type of the `RESTMapper` field of `DynamicClientSet` was changed to an interface. - the type of the `client` field of `LogClient` was changed to an interface. - the low-level logic for making a Kubernetes client from a kubeconfig was moved into a function called `makeClient`. - add a `makeClient` field to `kubeProvider` as an indirection for test purposes. Closes #2767
- Loading branch information
1 parent
eaf6fb9
commit df718a6
Showing
13 changed files
with
1,074 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,7 @@ sdk/java/gradlew | |
sdk/java/gradlew.bat | ||
|
||
sdk/python/venv | ||
|
||
coverage/ | ||
coverage.txt | ||
ginkgo.report |
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
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
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
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
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
Oops, something went wrong.