From 73c8ecf5d615b46519f103fbeada98dc9d526601 Mon Sep 17 00:00:00 2001 From: rujche Date: Fri, 27 Dec 2024 17:40:48 +0800 Subject: [PATCH 1/4] Skip TestCreateSimulatedEffectivePom only when java command not exist --- cli/azd/internal/appdetect/pom_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/azd/internal/appdetect/pom_test.go b/cli/azd/internal/appdetect/pom_test.go index 0b5c65e33dc..7f1c6f0491e 100644 --- a/cli/azd/internal/appdetect/pom_test.go +++ b/cli/azd/internal/appdetect/pom_test.go @@ -1053,8 +1053,8 @@ func TestAbsorbBuildPlugin(t *testing.T) { } func TestCreateSimulatedEffectivePom(t *testing.T) { - if os.Getenv("GITHUB_ACTIONS") == "true" { - t.Skip("Skip TestCreateSimulatedEffectivePom in GitHub Actions because it will time out.") + if !commandExistsInPath("java") { + t.Skip("Skip TestCreateSimulatedEffectivePom because java command not exist.") } var tests = []struct { name string From 98fe2b9502267847adf8e4eecf17febae6f830ab Mon Sep 17 00:00:00 2001 From: rujche Date: Fri, 27 Dec 2024 17:42:19 +0800 Subject: [PATCH 2/4] Add "-v" when run "go test". --- .github/workflows/go-test-for-sjad-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go-test-for-sjad-branch.yml b/.github/workflows/go-test-for-sjad-branch.yml index bad4b06e15e..2b849a5ab41 100644 --- a/.github/workflows/go-test-for-sjad-branch.yml +++ b/.github/workflows/go-test-for-sjad-branch.yml @@ -31,4 +31,4 @@ jobs: - name: Run tests run: | cd ./cli/azd - go test $(go list ./... | grep -v github.com/azure/azure-dev/cli/azd/test/functional) -cover \ No newline at end of file + go test $(go list ./... | grep -v github.com/azure/azure-dev/cli/azd/test/functional) -cover -v From 43d2938985d04a318715b3825f7cb0736051fbb1 Mon Sep 17 00:00:00 2001 From: rujche Date: Fri, 27 Dec 2024 17:46:02 +0800 Subject: [PATCH 3/4] Fix type. --- cli/azd/internal/appdetect/pom_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/azd/internal/appdetect/pom_test.go b/cli/azd/internal/appdetect/pom_test.go index 7f1c6f0491e..6ffeeae806c 100644 --- a/cli/azd/internal/appdetect/pom_test.go +++ b/cli/azd/internal/appdetect/pom_test.go @@ -1054,7 +1054,7 @@ func TestAbsorbBuildPlugin(t *testing.T) { func TestCreateSimulatedEffectivePom(t *testing.T) { if !commandExistsInPath("java") { - t.Skip("Skip TestCreateSimulatedEffectivePom because java command not exist.") + t.Skip("Skip TestCreateSimulatedEffectivePom because java command doesn't exist.") } var tests = []struct { name string From 24b7dfc725f86e09f1fdd4c8b174ee4a29c7a436 Mon Sep 17 00:00:00 2001 From: rujche Date: Fri, 27 Dec 2024 18:02:47 +0800 Subject: [PATCH 4/4] Add more information about checking "java" command. --- cli/azd/internal/appdetect/pom_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cli/azd/internal/appdetect/pom_test.go b/cli/azd/internal/appdetect/pom_test.go index 6ffeeae806c..e89cbd9247e 100644 --- a/cli/azd/internal/appdetect/pom_test.go +++ b/cli/azd/internal/appdetect/pom_test.go @@ -1,7 +1,9 @@ package appdetect import ( + "log/slog" "os" + "os/exec" "path/filepath" "reflect" "strings" @@ -9,6 +11,12 @@ import ( ) func TestCreateEffectivePom(t *testing.T) { + if !commandExistsInPath("java") { + t.Skip("Skip TestCreateEffectivePom because java command doesn't exist.") + } else { + path, _ := exec.LookPath("java") + slog.Info("Java command found.", "path", path) + } tests := []struct { name string testPoms []testPom @@ -1055,6 +1063,9 @@ func TestAbsorbBuildPlugin(t *testing.T) { func TestCreateSimulatedEffectivePom(t *testing.T) { if !commandExistsInPath("java") { t.Skip("Skip TestCreateSimulatedEffectivePom because java command doesn't exist.") + } else { + path, _ := exec.LookPath("java") + slog.Info("Java command found.", "path", path) } var tests = []struct { name string