Skip to content

Commit

Permalink
Restructure template test output (#528)
Browse files Browse the repository at this point in the history
Developer experience improvement to have the summary of the template
infra tests show more detail about which things passed and which failed,
to make it easier to know which set of logs to dive into.
  • Loading branch information
lorenyu authored Dec 21, 2023
1 parent 648d5ff commit 5f92599
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions template-only-test/template_infra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ import (
var uniqueId = strings.ToLower(random.UniqueId())
var projectName = fmt.Sprintf("plt-tst-act-%s", uniqueId)

func TestSetUpAccount(t *testing.T) {
func TestEndToEnd(t *testing.T) {
defer TeardownAccount(t)
SetUpProject(t, projectName)
SetUpAccount(t)

t.Run("SetUpAccount", SetUpAccount)
t.Run("ValidateAccount", ValidateAccount)
t.Run("TestNetwork", SubtestNetwork)
t.Run("Network", SubtestNetwork)
}

func ValidateAccount(t *testing.T) {
Expand All @@ -37,24 +36,21 @@ func ValidateAccount(t *testing.T) {

func SubtestNetwork(t *testing.T) {
defer TeardownNetwork(t)
SetUpNetwork(t)

t.Run("TestBuildRepository", SubtestBuildRepository)
t.Run("SetUpNetwork", SetUpNetwork)
t.Run("BuildRepository", SubtestBuildRepository)
}

func SubtestBuildRepository(t *testing.T) {
projectName := projectName
defer TeardownBuildRepository(t)
SetUpBuildRepository(t, projectName)
ValidateBuildRepository(t, projectName)

t.Run("TestDevEnvironment", SubtestDevEnvironment)
t.Run("SetUpBuildRepository", SetUpBuildRepository)
t.Run("ValidateBuildRepository", ValidateBuildRepository)
t.Run("Service", SubtestDevEnvironment)
}

func SubtestDevEnvironment(t *testing.T) {
defer TeardownDevEnvironment(t)
SetUpDevEnvironment(t)
ValidateDevEnvironment(t)
t.Run("SetUpDevEnvironment", SetUpDevEnvironment)
t.Run("ValidateDevEnvironment", ValidateDevEnvironment)
}

func SetUpProject(t *testing.T, projectName string) {
Expand Down Expand Up @@ -93,7 +89,7 @@ func SetUpNetwork(t *testing.T) {
fmt.Println("::endgroup::")
}

func SetUpBuildRepository(t *testing.T, projectName string) {
func SetUpBuildRepository(t *testing.T) {
fmt.Println("::group::Creating build repository resources")
shell.RunCommand(t, shell.Command{
Command: "make",
Expand Down Expand Up @@ -156,7 +152,7 @@ func ValidateGithubActionsAuth(t *testing.T, accountId string, projectName strin
fmt.Println("::endgroup::")
}

func ValidateBuildRepository(t *testing.T, projectName string) {
func ValidateBuildRepository(t *testing.T) {
fmt.Println("::group::Validating ability to publish build artifacts to build repository")

err := shell.RunCommandE(t, shell.Command{
Expand Down

0 comments on commit 5f92599

Please sign in to comment.