Skip to content

Test output includes yaml files unrelated to the test #7

@Travisivart

Description

@Travisivart

I created some Kubernetes tests with a folder structure as such:

root-directory/tests/functional-gdt/network/00-create-network-cr.yaml

tests:
 - kube.create: network/manifests/custom-network-cr.yaml

I also have some other yaml files which I am not currently running in the test:
root-directory/tests/functional-gdt/network/custom-network-cr2.yaml
root-directory/tests/functional-gdt/network/custom-network-cr3.yaml

root-directory/tests/functional-gdt/network/manifests/custom-network-cr.yaml:

---
apiVersion: v1
kind: customNetwork
  name: my-custom-network
  namespace: my-namespace
spec:
  networkSpec: 'data'

And the following suite_test.go

package functional

import (
	"os"
	"testing"

	"github.com/gdt-dev/gdt"
	_ "github.com/gdt-dev/kube"
)

const (
	debugEnvKey = "DEBUG"
)

func TestNetwork(t *testing.T) {
	s, err := gdt.From("network")
	if err != nil {
		t.Fatal(err)
	}

	ctx := gdt.NewContext()
	if _, found := os.LookupEnv(debugEnvKey); found {
		ctx = gdt.SetDebug(ctx, os.Stdout)
	}

	err = s.Run(ctx, t)
	if err != nil {
		t.Fatal(err)
	}
}

When running the test the output seems to indicate it is Running the additional unused yaml files:

go test -v ./...
=== RUN   TestNetwork
=== RUN   TestNetwork/00-create-networks.yaml
=== RUN   TestNetwork/00-create-networks.yaml/kube.create:custom-network-cr.yaml
=== RUN   TestNetwork/custom-network-cr.yaml
=== RUN   TestNetwork/custom-network-cr2.yaml
=== RUN   TestNetwork/custom-network-cr3.yaml
--- PASS: TestNetwork (0.03s)
    --- PASS: TestNetwork/00-create-networks.yaml (0.03s)
        --- PASS: TestNetwork/00-create-networks.yaml/kube.create:custom-network-cr.yaml (0.03s)
    --- PASS: TestNetwork/custom-network-cr.yaml (0.00s)
    --- PASS: TestNetwork/custom-network-cr2.yaml (0.00s)
    --- PASS: TestNetwork/custom-network-cr3.yaml (0.00s)
PASS
ok      root-directory/tests/functional-gdt   0.045s

Of course those aren't actual tests to be run or passed, but are just the custom crs I plan to test with. It also doesn't seem to create them just indicates they are RUN or PASS in the output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions