Skip to content

Releases: gdt-dev/kube

v1.9.1

03 Sep 17:47
86f2cee
Compare
Choose a tag to compare

What's Changed

  • fix inability to reference same-named Kinds by @jaypipes in #22

Full Changelog: v1.9.0...v1.9.1

v1.9.0

25 Jun 16:36
cbcef29
Compare
Choose a tag to compare

What's Changed

  • ensure no retry for create/apply/delete by @jaypipes in #18

Full Changelog: v1.8.0...v1.9.0

v1.8.0

21 Jun 15:30
3e24bea
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.4.0...v1.8.0

v1.4.0

17 Jun 10:58
efdb1a1
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.3.0...v1.4.0

v1.3.0

18 Feb 22:27
f2cbad8
Compare
Choose a tag to compare
  • Separate Action into own file (#3)
  • Rework label selector and resource identifier types (#3)
  • Align path-formats with gdt-core
  • Bring gdt-core up to v1.3.0 (#5)
  • Refactor Action system (#6)

v1.1.1

08 Aug 15:54
35a5d58
Compare
Choose a tag to compare

Brings in gdt@v1.1.1 and ensures that the test units/specs call
testing.T.Error() instead of relying on the Scenario.Run() to do
that.

Also adds a custom YAML unmarshaler for the Expect struct and adds
better parse-time errors for the matches field as requested in Issue
8.

Addresses Issue gdt-dev/gdt#8

v1.1.0

30 Jul 15:44
Compare
Choose a tag to compare

New functionality

Skip scenario if condition true (gdt-dev/gdt#5)

Adds the ability to skip a test scenario if a condition evaluates to true. Use the skip-if field in the Scenario YAML to tell gdt to skip the scenario if that condition evaluates to true. The condition is just a test.

For example, let's assume you have a gdt-kube scenario that looks like
this:

tests:
 - kube.create: manifests/nginx-deployment.yaml
 - kube:
   get: deployments/nginx
   assert:
     matches:
       status:
         readyReplicas: 2
 - kube.delete: deployments/nginx

If you execute the above test and there is already an 'nginx'
deployment, the kube.create test will fail. To prevent the scenario
from proceeding with the tests if an 'nginx' deployment already exists,
you could add the following

skip-if:
 - kube.get: deployments/nginx
tests:
 - kube.create: manifests/nginx-deployment.yaml
 - kube:
   get: deployments/nginx
   assert:
     matches:
       status:
         readyReplicas: 2
 - kube.delete: deployments/nginx

With the above, if an 'nginx' deployment exists already, the scenario
will skip all the tests.

Breaking changes in YAML definitions

exec plugin assertions now under assert field (gdt-dev/gdt#6)

The exec plugin now nests its assertions under an assert field.

So, instead of this:

tests:
 - exec: echo cat
   out:
     is: cat

you now do this:

tests:
 - exec: echo cat
   assert:
     out:
       is: cat

require renamed to fixtures (gdt-dev/gdt#2)

The require field in the Scenario YAML definition has been renamed to the more appropriate fixtures, since this field lists the fixtures that the scenario requires.

kube plugin assertions now in assert field

The kube.assert field in the kube plugin's Spec YAML definition has been renamed to the shorter assert, matching both the exec and http plugin.

v1.0.0

26 Jul 16:25
Compare
Choose a tag to compare

Migration of github.com/jaypipes/gdt-kube to github.com/gdt-dev/kube.

To use gdt, define your tests in a YAML file or a directory containing YAML files, use the gdt.From() method to create a runnable test suite or scenario and then Run() it:

package mypackage_test

import (
	"context"
	"path/filepath"
	"testing"

	"github.com/gdt-dev/gdt"
	_ "github.com/gdt-dev/http"
	"github.com/stretchr/testify/require"
)

func TestRunASuite(t *testing.T) {
	require := assert.New(t)

	fp := filepath.Join("suite", "testdata", "http")
	s, err := gdt.From(fp)
	require.Nil(err)
	
	s.Run(context.TODO(), t)
}

func TestRunOneScenario(t *testing.T) {
	require := require.New(t)

	fp := filepath.Join("suite", "testdata", "http", "create-then-get-book.yaml")
	s, err := gdt.From(fp)
	require.Nil(err)

	s.Run(context.TODO(), t)
}

Example gdt-kube file: testdata/matches.yaml:

name: matches
description: create a deployment and check the matches condition succeeds
require:
  - kind
tests:
  - name: create-deployment
    kube:
      create: testdata/manifests/nginx-deployment.yaml
  - name: deployment-exists
    kube:
      get: deployments/nginx
      assert:
        matches:
          spec:
            replicas: 2
            template:
              metadata:
                labels:
                  app: nginx
          status:
            readyReplicas: 2
  - name: delete-deployment
    kube:
      delete: deployments/nginx

file: matches_test.go

import (
    "github.com/gdt-dev/gdt"
    _ "github.com/gdt-dev/kube"
    kindfix "github.com/gdt-dev/kube/fixture/kind"
)

func TestMatches(t *testing.T) {
	fp := filepath.Join("testdata", "matches.yaml")

	kfix := kindfix.New()

	s, err := gdt.From(fp)

	ctx := gdt.NewContext(gdt.WithDebug())
	ctx = gdt.RegisterFixture(ctx, "kind", kfix)
	s.Run(ctx, t)
}