Skip to content

Commit

Permalink
update to gdt@1.1.0
Browse files Browse the repository at this point in the history
Brings in `gdt` v1.1.0 and adapts the Spec class to the new `Eval()`
function signature.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
  • Loading branch information
jaypipes committed Jul 30, 2023
1 parent fa84f1c commit 8c46526
Show file tree
Hide file tree
Showing 25 changed files with 106 additions and 118 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ All `gdt` scenarios have the following fields:
contents
* `defaults`: (optional) is a map, keyed by a plugin name, of default options
and configuration values for that plugin.
* `require`: (optional) list of strings indicating named fixtures that will be
* `fixtures`: (optional) list of strings indicating named fixtures that will be
started before any of the tests in the file are run
* `tests`: list of [`Spec`][basespec] specializations that represent the
runnable test units in the test scenario.
Expand Down Expand Up @@ -264,7 +264,7 @@ definition contained in a YAML file:
```yaml
name: create-get-delete-pod
description: create, get and delete a Pod
require:
fixtures:
- kind
tests:
- name: create-pod
Expand All @@ -284,7 +284,7 @@ definition using an inline YAML blob:
```yaml
name: create-get-delete-pod
description: create, get and delete a Pod
require:
fixtures:
- kind
tests:
# "kube.create" is a shortcut for the longer object->field format
Expand Down Expand Up @@ -314,7 +314,7 @@ connectivity to the Pod.
```yaml
name: create-check-ssh
description: create a Deployment then check SSH connectivity
require:
fixtures:
- kind
tests:
- kube.create: manifests/deployment.yaml
Expand Down Expand Up @@ -553,7 +553,7 @@ file `testdata/apply-deployment.yaml`:
```yaml
name: apply-deployment
description: create, get, apply a change, get, delete a Deployment
require:
fixtures:
- kind
tests:
- name: create-deployment
Expand Down Expand Up @@ -610,7 +610,7 @@ file: `testdata/matches.yaml`:
```yaml
name: matches
description: create a deployment and check the matches condition succeeds
require:
fixtures:
- kind
tests:
- name: create-deployment
Expand Down Expand Up @@ -751,11 +751,11 @@ func TestExample(t *testing.T) {
}
```

In your test file, you would list the "kind" fixture in the `requires` list:
In your test file, you would list the "kind" fixture in the `fixtures` list:

```yaml
name: example-using-kind
require:
fixtures:
- kind
tests:
- kube.get: pods/nginx
Expand Down
12 changes: 12 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ var (
"%w: condition does not match expectation",
gdterrors.ErrFailure,
)
// ErrConnect is returned when we failed to create a client config to
// connect to the Kubernetes API server.
ErrConnect = fmt.Errorf(
"%w: k8s connect failure",
gdterrors.RuntimeError,
)
)

// KubeConfigNotFound returns ErrKubeConfigNotFound for a given filepath
Expand Down Expand Up @@ -184,3 +190,9 @@ func MatchesNotEqual(msg string) error {
func ConditionDoesNotMatch(msg string) error {
return fmt.Errorf("%w: %s", ErrConditionDoesNotMatch, msg)
}

// ConnectError returns ErrConnnect when an error is found trying to construct
// a Kubernetes client connection.
func ConnectError(err error) error {
return fmt.Errorf("%w: %s", ErrConnect, err)
}
Loading

0 comments on commit 8c46526

Please sign in to comment.