Skip to content
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

Add crd test command and GitHub action config #96

Merged
merged 6 commits into from
Aug 19, 2024

Conversation

Skarlso
Copy link
Owner

@Skarlso Skarlso commented Aug 18, 2024

No description provided.

@Skarlso
Copy link
Owner Author

Skarlso commented Aug 19, 2024

./cty test sample-tests
+-----------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+
| IT                                | MATCHER       | ERROR                                                                                                                                 | TEMPLATE                                                           |
+-----------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+
| matches bootstrap crds correctly  | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/bootstrap_crd.yaml                               |
| matches bootstrap crds correctly  | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/bootstrap_crd.yaml                               |
| matches some custom stuff         | matchString   | <nil>                                                                                                                                 | sample-tests/crds/bootstrap_crd.yaml                               |
| matches AWSCluster crds correctly | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
| matches AWSCluster crds correctly | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
| matches AWSCluster crds correctly | matchString   | <nil>                                                                                                                                 | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
| matches AWSCluster crds correctly | matchString   | matcher returned failure: failed to validate kind AWSCluster: spec.controlPlaneEndpoint.host in body must be of type string: "number" | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
+-----------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+

Tests total: 7, failed: 1, passed: 6
Error: 1 test(s) failed
Usage:
  crd-to-sample test [flags]

Flags:
  -h, --help     help for test
  -u, --update   Update any existing snapshots.

2024/08/19 08:23:42 failed to run command: 1 test(s) failed

Arguably the output could be nicer and the failure including the HELP of the command is ugly.

@Skarlso
Copy link
Owner Author

Skarlso commented Aug 19, 2024

✗ ./cty test sample-tests
+-----------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+
| IT                                | MATCHER       | ERROR                                                                                                                                 | TEMPLATE                                                           |
+-----------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+
| matches AWSCluster crds correctly | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
| matches AWSCluster crds correctly | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
| matches AWSCluster crds correctly | matchString   | <nil>                                                                                                                                 | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
| matches AWSCluster crds correctly | matchString   | matcher returned failure: failed to validate kind AWSCluster: spec.controlPlaneEndpoint.host in body must be of type string: "number" | sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml |
| matches bootstrap crds correctly  | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/bootstrap_crd.yaml                               |
| matches bootstrap crds correctly  | matchSnapshot | <nil>                                                                                                                                 | sample-tests/crds/bootstrap_crd.yaml                               |
| matches some custom stuff         | matchString   | <nil>                                                                                                                                 | sample-tests/crds/bootstrap_crd.yaml                               |
+-----------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+

Tests total: 7, failed: 1, passed: 6
➜  crd-to-sample-yaml git:(add-crd-test-command-and-github-action-config) ✗ echo $?
1
➜  crd-to-sample-yaml git:(add-crd-test-command-and-github-action-config) ✗

That's better.

@Skarlso
Copy link
Owner Author

Skarlso commented Aug 19, 2024

Screenshot 2024-08-19 at 08 47 33

Added some color and wrapping of long text into the mix.

@Skarlso Skarlso marked this pull request as ready for review August 19, 2024 09:41
@Skarlso Skarlso merged commit 858e82c into main Aug 19, 2024
2 checks passed
@Skarlso Skarlso deleted the add-crd-test-command-and-github-action-config branch August 19, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant