Skip to content

Commit

Permalink
test: Skip resource_test.go when chrome is unavailable
Browse files Browse the repository at this point in the history
Signed-off-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mahendrapaipuri committed Aug 8, 2024
1 parent fd85911 commit 057daf2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/plugin/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"os/exec"
"strings"
"testing"

Expand All @@ -27,6 +28,31 @@ func (s *mockCallResourceResponseSender) Send(response *backend.CallResourceResp

// Test report resource
func TestReportResource(t *testing.T) {
var execPath string
locations := []string{
// Mac
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
// Windows
"chrome.exe",
// Linux
"google-chrome",
"chrome",
}

for _, path := range locations {
found, err := exec.LookPath(path)
if err == nil {
execPath = found

break
}
}

// Skip test if chrome is not available
if execPath == "" {
t.Skip("Chrome not found. Skipping test")
}

// Initialize app
inst, err := NewDashboardReporterApp(context.Background(), backend.AppInstanceSettings{
DecryptedSecureJSONData: map[string]string{
Expand Down

0 comments on commit 057daf2

Please sign in to comment.