github.com/buildpacks/pack@v0.33.3-0.20240516162812-884dd1837311/acceptance/assertions/test_buildpack_output.go (about) 1 //go:build acceptance 2 // +build acceptance 3 4 package assertions 5 6 import ( 7 "testing" 8 9 h "github.com/buildpacks/pack/testhelpers" 10 ) 11 12 type TestBuildpackOutputAssertionManager struct { 13 testObject *testing.T 14 assert h.AssertionManager 15 output string 16 } 17 18 func NewTestBuildpackOutputAssertionManager(t *testing.T, output string) TestBuildpackOutputAssertionManager { 19 return TestBuildpackOutputAssertionManager{ 20 testObject: t, 21 assert: h.NewAssertionManager(t), 22 output: output, 23 } 24 } 25 26 func (t TestBuildpackOutputAssertionManager) ReportsReadingFileContents(phase, path, content string) { 27 t.testObject.Helper() 28 29 t.assert.ContainsF(t.output, "%s: Reading file '%s': %s", phase, path, content) 30 } 31 32 func (t TestBuildpackOutputAssertionManager) ReportsWritingFileContents(phase, path string) { 33 t.testObject.Helper() 34 35 t.assert.ContainsF(t.output, "%s: Writing file '%s': written", phase, path) 36 } 37 38 func (t TestBuildpackOutputAssertionManager) ReportsFailingToWriteFileContents(phase, path string) { 39 t.testObject.Helper() 40 41 t.assert.ContainsF(t.output, "%s: Writing file '%s': failed", phase, path) 42 } 43 44 func (t TestBuildpackOutputAssertionManager) ReportsConnectedToInternet() { 45 t.testObject.Helper() 46 47 t.assert.Contains(t.output, "RESULT: Connected to the internet") 48 } 49 50 func (t TestBuildpackOutputAssertionManager) ReportsDisconnectedFromInternet() { 51 t.testObject.Helper() 52 53 t.assert.Contains(t.output, "RESULT: Disconnected from the internet") 54 } 55 56 func (t TestBuildpackOutputAssertionManager) ReportsBuildStep(message string) { 57 t.testObject.Helper() 58 59 t.assert.ContainsF(t.output, "Build: %s", message) 60 }