Skip to content
Snippets Groups Projects
Select Git revision
  • 59a15da27280a4a487a8755d0e5d12ad4a84dbc1
  • master default protected
  • v0.0.x
  • v0.0.31
  • v0.0.30
  • v0.0.29
  • v0.0.28
  • v0.0.28-rc1
  • v0.0.27
  • v0.0.26
  • v0.0.25
  • v0.0.24
  • v0.0.23
  • v0.0.22
  • v0.0.21
  • v0.0.20
  • v0.0.19
  • v0.0.18
  • v0.0.17
  • v0.0.16
  • v0.0.15
  • v0.0.14
  • v0.0.13
23 results

pod_test.go

Blame
  • pod_test.go 5.09 KiB
    //go:build e2e
    // +build e2e
    
    package test
    
    import (
    	"fmt"
    	"strings"
    	"testing"
    	"time"
    
    	"github.com/kelseyhightower/envconfig"
    	"github.com/stretchr/testify/suite"
    )
    
    const (
    	hostPathVolumeType = "hostPath"
    	localVolumeType    = "local"
    )
    
    type PodTestSuite struct {
    	suite.Suite
    
    	config       testConfig
    	kustomizeDir string
    }
    
    func (p *PodTestSuite) SetupSuite() {
    	err := envconfig.Process("test", &p.config)
    	if err != nil {
    		panic(err)
    	}
    
    	p.T().Logf("using test config: %+v", p.config)
    
    	p.TearDownSuite()
    
    	//kind load docker-image "$image"
    	cmds := []string{
    		fmt.Sprintf("kind create cluster --config=%s --wait=120s", testdataFile("kind-cluster.yaml")),
    		fmt.Sprintf("kind load docker-image %s", p.config.IMAGE),
    	}
    	for _, cmd := range cmds {
    		_, err = runCmd(
    			p.T(),
    			cmd,
    			"",
    			p.config.envs(),
    			nil,
    		)
    		if err != nil {
    			p.FailNow("", "failed to create the cluster or load image", err)
    		}
    	}
    }
    
    func (p *PodTestSuite) TearDownSuite() {
    	err := deleteCluster(
    		p.T(),
    		p.config.envs(),
    	)
    	if err != nil {
    		p.Failf("", "failed to delete the cluster: %v", err)
    	}
    }
    
    func (p *PodTestSuite) TearDownTest() {
    	err := deleteKustomizeDeployment(
    		p.T(),
    		p.kustomizeDir,