MCPcopy
hub / github.com/kptdev/kpt / AssertKptfile

Method AssertKptfile

internal/testutil/testutil.go:241–254  ·  view source on GitHub ↗

AssertKptfile verifies the contents of the KptFile matches the provided value.

(t *testing.T, cloned string, kpkg kptfile.KptFile)

Source from the content-addressed store, hash-verified

239
240// AssertKptfile verifies the contents of the KptFile matches the provided value.
241func (g *TestGitRepo) AssertKptfile(t *testing.T, cloned string, kpkg kptfile.KptFile) bool {
242 // read the actual generated KptFile
243 b, err := ioutil.ReadFile(filepath.Join(cloned, kptfile.KptFileName))
244 if !assert.NoError(t, err) {
245 return false
246 }
247 actual := kptfile.KptFile{}
248 d := yaml.NewDecoder(bytes.NewBuffer(b))
249 d.KnownFields(true)
250 if !assert.NoError(t, d.Decode(&actual)) {
251 return false
252 }
253 return assert.Equal(t, kpkg, actual)
254}
255
256// CheckoutBranch checks out the git branch in the repo
257func (g *TestGitRepo) CheckoutBranch(branch string, create bool) error {

Callers 12

TestCmd_executeFunction · 0.45
TestCmd_executeFunction · 0.45
TestCommand_RunFunction · 0.45
TestCommand_Run_subdirFunction · 0.45
TestCommand_Run_branchFunction · 0.45
TestCommand_Run_tagFunction · 0.45
TestCommand_Run_cleanFunction · 0.45

Calls

no outgoing calls

Tested by 12

TestCmd_executeFunction · 0.36
TestCmd_executeFunction · 0.36
TestCommand_RunFunction · 0.36
TestCommand_Run_subdirFunction · 0.36
TestCommand_Run_branchFunction · 0.36
TestCommand_Run_tagFunction · 0.36
TestCommand_Run_cleanFunction · 0.36