Skip to content

Commit

Permalink
🧪 Fix IDE tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Aug 1, 2024
1 parent 482ea74 commit 9610aa1
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions core/installers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/JetBrains/qodana-cli/v2024/platform"
"os"
"path/filepath"
"runtime"
"testing"
)

Expand Down Expand Up @@ -53,18 +52,13 @@ func TestDownloadAndInstallIDE(t *testing.T) {
}

func DownloadAndInstallIDE(ideName string, t *testing.T) {
tempDir, err := os.MkdirTemp("", "productByCode")
tempDir := filepath.Join(os.TempDir(), ".qodana_scan_", "ideTest")
err := os.MkdirAll(tempDir, 0755)
if err != nil {
platform.ErrorMessage("Cannot create temp dir: %s", err)
t.Fail()
}

defer func(path string) {
err := os.RemoveAll(path)
if err != nil {
platform.ErrorMessage("Cannot clean up temp dir: %s", err)
}
}(tempDir) // clean up

opts := &QodanaOptions{
&platform.QodanaOptions{
Ide: ideName,
Expand All @@ -75,18 +69,10 @@ func DownloadAndInstallIDE(ideName string, t *testing.T) {
platform.ErrorMessage("Cannot install %s", ideName)
t.Fail()
}

if //goland:noinspection GoBoolExpressions
runtime.GOOS == "darwin" {
ide = filepath.Join(ide, "Contents")
}
prod, err := readIdeProductInfo(ide)
defer func(path string) {
err := os.RemoveAll(path)
if err != nil {
platform.ErrorMessage("Cannot clean up temp dir: %s", err)
}
}(ide) // clean up
if err != nil || prod == nil {
t.Fatalf("Failed to read IDE product info: %v", err)
}
if prod.ProductCode == "" {
t.Fail()
}
Expand Down

0 comments on commit 9610aa1

Please sign in to comment.