MCPcopy
hub / github.com/redspread/spread / testCompareEntity

Function testCompareEntity

pkg/input/dir/source_test.go:393–421  ·  view source on GitHub ↗
(t *testing.T, expected, actual entity.Entity)

Source from the content-addressed store, hash-verified

391}
392
393func testCompareEntity(t *testing.T, expected, actual entity.Entity) bool {
394 assert.Equal(t, expected.Source(), actual.Source(), "sources should match")
395 assert.Equal(t, expected.DefaultMeta(), actual.DefaultMeta())
396
397 actualImages := actual.Images()
398 expectedImages := expected.Images()
399 assert.Len(t, actualImages, len(expectedImages))
400 for _, expectImage := range expectedImages {
401 found := false
402 for _, actualImage := range actualImages {
403 found = expectImage.Equal(actualImage)
404 if found {
405 break
406 }
407 }
408 assert.True(t, found, "should have found image")
409 }
410
411 expectedDeploy, err := expected.Deployment()
412 assert.NoError(t, err)
413 actualDeploy, err := actual.Deployment()
414 assert.NoError(t, err)
415
416 if !assert.True(t, expectedDeploy.Equal(actualDeploy)) {
417 t.Log(expectedDeploy.Diff(actualDeploy))
418 return false
419 }
420 return true
421}

Callers 5

TestInputPodFunction · 0.85
TestInputRCAndPodFunction · 0.85
TestSourceRCsFunction · 0.85
TestSourcePodsFunction · 0.85
TestSourceContainersDirFunction · 0.85

Calls 7

SourceMethod · 0.65
DefaultMetaMethod · 0.65
ImagesMethod · 0.65
DeploymentMethod · 0.65
EqualMethod · 0.45
LenMethod · 0.45
DiffMethod · 0.45

Tested by

no test coverage detected