Commit Graph

3096 Commits (28971edc07a55676be96e7aa639be3467030c15b)
 

Author SHA1 Message Date
Stefan Prodan def92e14ee
Merge pull request from allenporter/flux-test-cleanup
Rename trace test golden files
Allen Porter 11708d4189 Rename trace test golden files
Rename trace test golden files to match the convention used by other tests

Signed-off-by: Allen Porter <allen@thebends.org>
Stefan Prodan 2bc64bf419
Merge pull request from allenporter/flux-cmd-test-func
Make test harness more flexible with functions
Allen Porter 3a3bdc62c8 Make test harness more flexible with functions
Replace the 4 arguments to cmdTestCase with a function that
can let tests run arbitrary logic if it is more complex than
what is provided by the test harness. Move the existing logic
into functions that the test can use for common assertions on
golden files and golden values.

These changes were pulled out of PR  to make a smaller review.

Signed-off-by: Allen Porter <allen@thebends.org>
Stefan Prodan 72294b2a56
Merge pull request from fluxcd/arm64-e2e
Move arm64 e2e to Go tests
Stefan Prodan 94940a20ef
Move arm64 e2e to Go tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Stefan Prodan 219ff2ef7d
Merge pull request from timja/patch-1
Avoid substitution issue in kustomize for azure credentials sync
Tim Jacomb bc2de741b8
Avoid substitution issue in kustomize for azure credentials sync
Signed-off-by: Tim Jacomb <tim.jacomb@hmcts.net>
Stefan Prodan 5eabd4e898
Merge pull request from allenporter/flux-envtest
Remove fakeclient and use testenv for flux cmd tests
Allen Porter e8d6d5fe5c Remove fakeclient and use testenv for flux cmd tests
Remove use of the fake client, and replace with a real client connected to the
testEnv.

This required fixes to the yaml files as the testEnv has stricter verifcation
of objects. This also meant it was not possible to test a GitRepository with
a missing artifact since that is not a valid state.

The tests are slower than before, taking around 7-10 seconds each because the
 testEnv is setup and destroyed for every test. These will be sped up in a
 follow up PR.

Signed-off-by: Allen Porter <allen@thebends.org>
Stefan Prodan 55bd93ff79
Merge pull request from fluxcd/make-envtest
Wire kubebuilder assets to envtest bin
Stefan Prodan b34b2d779b
Wire kubebuilder assets to envtest bin
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Stefan Prodan 103ed2be65
Merge pull request from chanwit/e2e_check_pre
Add e2e test case fo check --pre
Chanwit Kaewkasi cc32c1be07 add e2e test for check --pre with templating support
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Stefan Prodan a3ba9817a3
Merge pull request from dholbach/update-calendar
Update links to calendar and resources
Daniel Holbach 6d5f1b17ad update links to calendar and resources
Signed-off-by: Daniel Holbach <daniel@weave.works>
Stefan Prodan 0d5d5fce46
Merge pull request from fluxcd/test-ref
Refactor e2e tests
Stefan Prodan 375edffd15
Add image scanning e2e tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Stefan Prodan d1982e64b2
Refactor e2e tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Stefan Prodan cec8b5336c
Merge pull request from chanwit/e2e_install
Implement testEnv for e2e tests
Chanwit Kaewkasi 8f78263455 implement testEnv for e2e tests
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
Stefan Prodan cb96bca6aa
Merge pull request from souleb/main
Adds a watch flag to the get command
Soule BA c18d0b9217 Adds a watch flag to the get command
The new flag fetch and display the request ressource and then continue
watching the ressource until timeout or cancellation.

A single ressource/ressource type is supported.

Signed-off-by: Soule BA <soule@weave.works>
Hidde Beydals d1970185b9
Merge pull request from fluxcd/update-components
Update toolkit components
fluxcdbot 794d3ee2f5 Update toolkit components
- helm-controller to v0.11.2
  https://github.com/fluxcd/helm-controller/blob/v0.11.2/CHANGELOG.md
- kustomize-controller to v0.13.3
  https://github.com/fluxcd/kustomize-controller/blob/v0.13.3/CHANGELOG.md
- source-controller to v0.15.4
  https://github.com/fluxcd/source-controller/blob/v0.15.4/CHANGELOG.md
- notification-controller to v0.15.1
  https://github.com/fluxcd/notification-controller/blob/v0.15.1/CHANGELOG.md
- image-reflector-controller to v0.11.1
  https://github.com/fluxcd/image-reflector-controller/blob/v0.11.1/CHANGELOG.md
- image-automation-controller to v0.14.1
  https://github.com/fluxcd/image-automation-controller/blob/v0.14.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
Hidde Beydals daeef98dfb
Merge pull request from allenporter/flux-test-main
Replace init() with TestMain()
Allen Porter 4146df1f02 Replace init() with TestMain()
Signed-off-by: Allen Porter <allen@thebends.org>
Hidde Beydals 78f4dfa48d
Merge pull request from allenporter/flux-cmd-ioutil
Remove deprecated io/ioutil usage
Allen Porter 8b68d7d7e2 Remove deprecated io/ioutil usage
Issue 

Signed-off-by: Allen Porter <allen@thebends.org>
Stefan Prodan ba1bba17ad
Merge pull request from charles-woshicai/print-success-message
feat: display success message while create secrets via `flux` cli.
Charles Cai 70f2b5028f feat: display success message while create secrets via `flux` cli.
Signed-off-by: Charles Cai <charles.cai@sap.com>
Hidde Beydals 4f4f0d70a4
Merge pull request from fluxcd/patch-reconcile-req
Request reconcile using patch instead of update
Hidde Beydals 9607b07e65 Request reconcile using patch instead of update
This should prevent the generation of the object getting bumped, as
observed on a GKE K8s 1.18 cluster using the  logic before this commit.

We only want to generation to increase when there are actual changes to
the `spec` of a resource, as some controllers use the `generation`
value to make assumptions about what they should do during a
reconciliation.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Stefan Prodan 3570fab0f9
Merge pull request from fluxcd/refactor-tests
Refactor test helpers
Stefan Prodan dd0f17d7a5
Refactor test helpers
- move test helpers to main
- add support for inline golden values
- add test for `flux --version`

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Stefan Prodan 2290880389
Merge pull request from allenporter/flux-trace
Add tests for flux trace command
Allen Porter 351d287d88 Add tests for flux trace command
Add tests for flux trace command that fake out the kubernetes client,
load objects from a yaml file and create them in the client, and
assert on the output of the trace command to an expected golden file.

This is a follow up from the suggestions in PR https://github.com/fluxcd/flux2/pull/1626 which suggested that additional
testing would be helpful. This test approach is modeled after the helm command tests.

This required some changes to the kubernetes client setup to make it
possible to use a fake. If we agree this pattern makes sense, it can be
applied to other commands.

Signed-off-by: Allen Porter <allen@thebends.org>
Hidde Beydals eba6706f15
Merge pull request from dmitrika/chore/remove-deprecated-ioutil
chore: remove deprecated io/ioutil
Dmitry Rybin 7f425efa6b chore: remove deprecated io/ioutil
Signed-off-by: Dmitry Rybin <ayrowa@yandex.ru>
Stefan Prodan d40685ab62
Merge pull request from fluxcd/gh-bug-template
Provide suggestion for some fields in bug report
Hidde Beydals f795e3eeb8 Provide suggestion for some fields in bug report
This commit adds suggestion for some of the required fields because
there can be a few exceptions in which these values can not be
provided. For example when the `flux` binary can not be installed, or
the set of controllers has been installed with just an `install.yaml`
file.

We use this approach instead of making the fields optional because it
guides people to provide the information whenever they can, which
should result in higher quality bug reports.

As a tiny addition, the reference to "Flux v2" has been renamed to just
"Flux" as we are slowly transitioning "Flux v1" into "Flux Legacy".

Signed-off-by: Hidde Beydals <hello@hidde.co>
Hidde Beydals d3944c0204
Merge pull request from fluxcd/gh-bug-template
Transform GitHub issue template to new format
Hidde Beydals 4086ab15fa Transform GitHub issue template to new format
This will help users to provide bug reports of high quality, as the
requested information is now rendered into dedicated fields, while
allowing us to mark fields as "required".

Signed-off-by: Hidde Beydals <hello@hidde.co>
Hidde Beydals 446a367094
Merge pull request from allenporter/flux-trace
Allen Porter bd250c9871 Fix template optional field check in trace
Signed-off-by: Allen Porter <allen@thebends.org>
Allen Porter 91b3788362 Fix trace for optional GitRepository.Spec.Reference
Check for existence of GitRepository.Spec.Reference when displaying a trace to
avoid error:

✗ template: tmpl:28:21: executing "tmpl" at <.GitRepository.Spec.Reference.Tag>: nil pointer evaluating *v1beta1.GitRepositoryRef.Tag

Fixes issue 
Manually tested using the use cases highlighted in the issue.

Signed-off-by: Allen Porter <allen@thebends.org>
Hidde Beydals 658dbb9ea8
Merge pull request from darkowlzz/utils-tests
internal/utils: Add unit tests
Sunny 1257b9cbc8
internal/utils: Add unit tests
Add unit tests for various utils functions.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
Stefan Prodan 0ae39d5a0a
Merge pull request from chanwit/status-selector
Add status-selector flag for get commands to filter results based on status conditions
Chanwit Kaewkasi d8911e0c77 add an example to the status-selector flag's description
Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>