Commit Graph

23 Commits

Author SHA1 Message Date
Karl Isenberg f9563d9e37 chore: Upgrade to Ginkgo v2 2022-04-21 18:50:30 -07:00
Kubernetes Prow Robot 2bfa520569
Merge pull request #579 from karlkfi/karl-error-status
fix: Send Failed status when erroring
2022-04-20 09:37:42 -07:00
Karl Isenberg 119b51aabf fix: Send Failed status when erroring
- Caller should switch on Type == Failed, not Error != nil
- Error should always be non-nil for Failed and Skipped events
2022-04-19 18:22:52 -07:00
Karl Isenberg 4c53ada4bc chore: Test for more specific errors 2022-04-19 18:08:24 -07:00
Karl Isenberg f124e7bb7f chore: Fix event sorting for testing
Previous sorting method was not stable, and only worked coincidentally
for the two use cases that were using it. This new method works on
more event types and only sorts contiguous events. This should make
the sort usable when we add parallel apply and watch instead of poll.
2022-04-15 15:52:11 -07:00
Karl Isenberg 393ecfe7a5 feat: improve event status consistency
Event Changes:
- Renamed ActionGroupEvent.Type -> Status
- Renamed Event.Operation -> Status
- Renamed Status fields to use consistent prefixes and suffixes
- Combined Applied, Changed, Unchanged, and ServersideApplied into
  ApplySuccessful
- Added Failed status for apply, prune, and delete events
- Replaced Unspecified with Pending
- Made enum String output more consistent

Printer Changes:
- Added FormatSummary to print summary stats at the end of the
  apply/destroy, instead of after the last of each type of action
  group.
- Modified printer output to match new more consistent events.
- Updated JSON printer docs with latest schema details.

BREAKING CHANGE: Event "operations" and "type" are now "status"
BREAKING CHANGE: JSON printer schema changed to match events
BREAKING CHANGE: Event status enums renamed/refactored
2022-04-14 01:14:10 -07:00
Karl Isenberg 34a8a7b334 chore: add stress test
- Stress test tests 1,000 Namespaces, CofnigMaps, & CronTabs (CR)
- Stress test is a new test suite with its own make entrypoint
- Refactor shared test code so the e2e and stress tests can both use it
- Update test client QPS to 20 (from 5)
2022-03-10 17:21:26 -08:00
Karl Isenberg 4e94795493 chore: refactor inventory pkg to avoid stuttering 2022-02-15 14:48:39 -08:00
Mikhail Mazurskiy 2c815d2843
feat!: applier configuration options
BREAKING CHANGE: NewApplierBuilder() is the new way to construct an Applier
BREAKING CHANGE: apply.Options renamed into apply.ApplierOptions
2022-01-29 10:04:03 +11:00
Karl Isenberg 242b6aa83e fix: Don't panic when ObjMetadata is invalid
- UnstructuredToObjMetaOrDie -> UnstructuredToObjMetadata
- UnstructuredToObjMeta -> UnstructuredToObjectMetadata
- UnstructuredsToObjMetasOrDie -> UnstructuredSetToObjMetadataSet
- UnstructuredsToObjMetas -> UnstructuredSetToObjMetadataSet
- Remove CreateObjMetadata (Validator performs validation)
2022-01-07 18:50:30 -08:00
Karl Isenberg c5636c0243 feat: Always wait for reconciliation
- Converted WaitTask to use a context for timeout/cancellation, to
  improve readability and reduce error cases. Now it only sends
  TaskResult events from one place, removing the need for a token to
  silence subsequent complete() calls.
- Add pending object tracking to WaitTask to ensure all objects are
  accounted for at least one WaitEvent.
- Upgraded applier tests to use full event comparison, for better signal
  on breaking changes.
- Enhanced task tests to consume all events before validating and test
  actual event output.
- Add set sorting to graph.SortObjs, to make wait event ordering more
  consistent, to make testing easier.

BREAKING CHANGE: wait tasks always execute after apply/prune/delete (except dry runs)
BREAKING CHANGE: wait tasks default to waiting until cancelled (previously 1m default)
2021-11-10 12:34:54 -08:00
Karl Isenberg 5f80d35a70 fix: Add context & timeouts to e2e tests
Tests will now each have a context that is cancelled on timeout.
BeforeEach and AfterEach blocks have their own timeouts, to allow
bounded setup and cleanup.

- Test Timeout: 5m
- Before Test Timeout: 30s
- After Test Timeout: 30s
2021-11-09 17:50:03 -08:00
Karl Isenberg 50fb925f41 Fix flaky continue on error test
- Add GroupedEventsByID to impliment a custom sort algorithm fo use by
  tests, to simplify the comparison of otherwise unsorted
  apply/prune/delete events in an action group.
2021-10-05 17:17:19 -07:00
Karl Isenberg 853f4b0d0b Add GroupName to Apply, Prune, and Delete events
- GroupName can be used to identify which ActionGroupEvent the
  Apply/Prune/Delete belongs to. This is useful for tracking progress
  during a long apply/destroy.
2021-10-05 17:14:11 -07:00
Karl Isenberg a2964373c8 Use runCollect in e2e tests more consistently 2021-09-29 16:02:04 -07:00
Karl Isenberg 3d81e21acf e2e test cleanup
- Unstructured() added to ResourceReference to aid test operations
- Test artifacts moved into artifacts_test.go
- deploymentManifest and apiserviceManifest replaced with
  yaml->unstructured, for consistency with other test artifacts
- Added withReplicas, withNamespace, and withDependsOn for easier inline
  mutation of test artifacts
- Added deleteUnstructuredAndWait, assertUnstructuredExists, and
  assertUnstructuredDoesNotExist to validate actual cluster state,
  not just events. Also reduced flakiness by waiting for delete.
- Removed error check before event validation. The event diff
  provides much more context for debugging.
- Replaced typed resources with unstructured and used
  testutil.NestedField to extract values.
- Updated prune error test to use full event list comparison and
  validate server state.
- Add 2nd resource to continue on error test
- Don't fail early on error from event list
- Fix flakey prune error test
  Add wait for pod2 after creation
  Add wait for pod2 after deletion
  Re-use inventory to ensure prune of pod2 not skipped
- Add optional klog support for e2e tests
2021-09-24 17:54:17 -07:00
Karl Isenberg 6992b74beb Add more robust event list testing in e2e tests
- Add testutil.Equal to show comparisons with cmp.Diff output
- Add github.com/google/go-cmp for cmp.Equal and cmp.Diff
  These comparison tools make debugging easier and properly handle
  error comparisons, using cmpopts.EquateErrors()
- Added EventsToExpEvents, EventToExpEvent, and RemoveEqualEvents
  to testutil to help with comparing event lists
- Add InitEvent to ExpEvent, to enable validating it exists
- e2e tests have all been upgraded to validate a full list of
  events, rather than just a partial list with partial contents.
  This should increase confidence that new changes don't break things.
2021-09-15 00:36:16 -07:00
Sean Sullivan 0777e622f1 Updates e2e tests 2021-07-01 17:47:06 -07:00
Morten Torkildsen 136d1efeeb Better validation of resources prior to actuation 2021-07-01 17:02:57 -07:00
Mikhail Mazurskiy 4eb7dc1f6f
Remove Initialize() on Destroyer and PruneOptions 2021-06-18 14:58:49 +10:00
Morten Torkildsen ae80e561e2 Improve the event hierarchy 2021-05-18 14:58:41 -07:00
Jingfang Liu 048e8867d6 add apply/preview/destroy flag: inventory-policy 2021-01-20 15:03:35 -08:00
Jingfang Liu 1f65c106fa add e2e test for continue on error 2021-01-06 19:30:43 -08:00