コード例 #1
0
func Test_TactPackage_should_failed_for_unknown_package(t *testing.T) {
	// given
	reportChan := make(chan message.Report, 1)
	defer close(reportChan)
	mes := message.ToWork{int64(1), message.PACKAGE, "plop/", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	// when
	build.TestPackage(mes, reportChan)
	msg := <-reportChan
	end := <-reportChan
	// then
	t.Logf("test the exec command failure. Output : %s, %d", msg.Logs, len(msg.Logs))
	assert.Contains(t, testtools.FromSliceToString(msg.Logs), "can't load package: package plop")
	assert.Equal(t, msg.Status, message.WORKING)
	assert.Equal(t, end.Status, message.FAILED)
}
コード例 #2
0
func Test_Should_Test_Sources(t *testing.T) {
	// given
	reportChan := make(chan message.Report, 1)
	defer close(reportChan)
	mes := message.ToWork{int64(1), message.PACKAGE, "toto-build-agent/testapp", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	// when
	build.TestPackage(mes, reportChan)
	msg := <-reportChan
	end := <-reportChan
	// then
	t.Logf("Test the go test command with succes. Output : %s\n", msg.Logs)
	assert.Contains(t, testtools.FromSliceToString(msg.Logs), "toto-build-agent/testapp")
	assert.Equal(t, msg.Status, message.WORKING)
	assert.Equal(t, end.Status, message.SUCCESS)
}