github.com/kubeshop/testkube@v1.17.23/internal/template/parser_test.go (about)

     1  package parser
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/require"
     9  
    10  	"github.com/kubeshop/testkube/internal/config"
    11  )
    12  
    13  // Test the ParseJobTemplate function
    14  func TestParseJobTemplate(t *testing.T) {
    15  	pwd, _ := os.Getwd()
    16  	t.Setenv("TESTKUBE_CONFIG_DIR", filepath.Join(pwd, "../../config"))
    17  
    18  	assertion := require.New(t)
    19  	cfg, err := config.Get()
    20  	assertion.NoError(err)
    21  
    22  	templates, err := ParseJobTemplates(cfg)
    23  
    24  	assertion.NoError(err)
    25  	// t.Log(jobTemplate)
    26  	assertion.NotEmpty(templates.Job)
    27  	// t.Log(slavePodTemplate)
    28  	assertion.NotEmpty(templates.Slave)
    29  	// t.Log(pvcTemplate)
    30  	assertion.NotEmpty(templates.PVC)
    31  }