1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/integration/integration_cnb_test.go
Pavel Busko 0271ef51c4
cnbBuild documentation for custom builders (#3077)
* Docs for user provided builder images

Co-authored-by: Benjamin Haegenlaeuer <benjamin.haegenlaeuer@sap.com>

* check if provided dockerImage is a valid builder

Co-authored-by: Pavel Busko <pavel.busko@sap.com>

Co-authored-by: Benjamin Haegenlaeuer <benjamin.haegenlaeuer@sap.com>
2021-09-14 15:38:58 +02:00

37 lines
1.3 KiB
Go

// +build integration
// can be execute with go test -tags=integration ./integration/...
package main
import (
"testing"
)
func TestNpmProject(t *testing.T) {
t.Parallel()
container := givenThisContainer(t, IntegrationTestDockerExecRunnerBundle{
Image: "paketobuildpacks/builder:full",
User: "cnb",
TestDir: []string{"testdata", "TestMtaIntegration", "npm"},
})
container.whenRunningPiperCommand("cnbBuild", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", "test")
container.assertHasOutput(t, "running command: /cnb/lifecycle/detector")
container.assertHasOutput(t, "Paketo NPM Start Buildpack")
container.assertHasOutput(t, "Saving test/not-found:0.0.1")
container.assertHasOutput(t, "failed to write image to the following tags: [test/not-found:0.0.1")
}
func TestWrongBuilderProject(t *testing.T) {
t.Parallel()
container := givenThisContainer(t, IntegrationTestDockerExecRunnerBundle{
Image: "nginx:latest",
TestDir: []string{"testdata", "TestMtaIntegration", "npm"},
})
container.whenRunningPiperCommand("cnbBuild", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", "test")
container.assertHasOutput(t, "the provided dockerImage is not a valid builder")
}