Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/release-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ jobs:
run: python3 -m pip install pipenv poetry

- name: Run Tests
run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
run: go test -tags integration github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }}
FROGBOT_V3_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_GITHUB_TOKEN }}

azure-integration:
name: Azure Integration Tests
Expand Down Expand Up @@ -178,11 +178,11 @@ jobs:
run: python3 -m pip install pipenv poetry

- name: Run Tests
run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
run: go test -tags integration azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }}
FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_AZURE_TOKEN }}

gitlab-integration:
name: GitLab Integration Tests
Expand Down Expand Up @@ -214,11 +214,11 @@ jobs:
run: python3 -m pip install pipenv poetry

- name: Run Tests
run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
run: go test -tags integration gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }}
FROGBOT_V3_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_GITLAB_TOKEN }}

bitbucket-server-integration:
name: Bitbucket Server Integration Tests
Expand Down Expand Up @@ -283,8 +283,8 @@ jobs:
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }}
run: go test -v bitbucket_server_test.go commands.go integrationutils.go
FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_BB_SERVER_TOKEN }}
run: go test -tags integration -v bitbucket_server_test.go commands.go integrationutils.go

- name: Display Logs on Failure
if: failure()
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ jobs:
${{ runner.os }}-go-

- name: Run Tests
run: go test github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
run: go test -tags integration github_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }}
FROGBOT_V3_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_GITHUB_TOKEN }}

azure-integration:
name: Azure Integration Tests
Expand Down Expand Up @@ -262,11 +262,11 @@ jobs:
${{ runner.os }}-go-

- name: Run Tests
run: go test azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
run: go test -tags integration azure_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_TESTS_AZURE_TOKEN }}
FROGBOT_TESTS_AZURE_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_AZURE_TOKEN }}

gitlab-integration:
name: GitLab Integration Tests
Expand Down Expand Up @@ -307,11 +307,11 @@ jobs:
${{ runner.os }}-go-

- name: Run Tests
run: go test gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
run: go test -tags integration gitlab_test.go integrationutils.go commands.go -v -race -timeout 30m -cover
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITLAB_TOKEN }}
FROGBOT_V3_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_GITLAB_TOKEN }}

bitbucket-server-integration:
name: Bitbucket Server Integration Tests
Expand Down Expand Up @@ -359,6 +359,6 @@ jobs:
env:
JF_URL: ${{ secrets.PLATFORM_URL }}
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }}
FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_TESTS_BB_SERVER_TOKEN }}
FROGBOT_TESTS_BB_SERVER_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_BB_SERVER_TOKEN }}
JFROG_CLI_LOG_LEVEL: "DEBUG"
run: go test -v bitbucket_server_test.go commands.go integrationutils.go
run: go test -tags integration -v bitbucket_server_test.go commands.go integrationutils.go
20 changes: 9 additions & 11 deletions azure_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build integration

package main

import (
Expand All @@ -21,30 +23,26 @@ func buildAzureReposClient(t *testing.T, azureToken string) vcsclient.VcsClient
return azureClient
}

func buildAzureReposIntegrationTestDetails(t *testing.T, useLocalRepo bool) *IntegrationTestDetails {
func buildAzureReposIntegrationTestDetails(t *testing.T) *IntegrationTestDetails {
integrationRepoToken := getIntegrationToken(t, azureIntegrationTokenEnv)
testDetails := NewIntegrationTestDetails(integrationRepoToken, string(utils.AzureRepos), azureGitCloneUrl, "frogbot-test", useLocalRepo)
testDetails := NewIntegrationTestDetails(integrationRepoToken, string(utils.AzureRepos), azureGitCloneUrl, "frogbot-test")
testDetails.ApiEndpoint = azureApiEndpoint
return testDetails
}

func azureReposTestsInit(t *testing.T, useLocalRepo bool) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildAzureReposIntegrationTestDetails(t, useLocalRepo)
func azureReposTestsInit(t *testing.T) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildAzureReposIntegrationTestDetails(t)
azureClient := buildAzureReposClient(t, testDetails.GitToken)
return azureClient, testDetails
}

func TestAzureRepos_ScanPullRequestIntegration(t *testing.T) {
azureClient, testDetails := azureReposTestsInit(t, false)
t.Fail()
azureClient, testDetails := azureReposTestsInit(t)
runScanPullRequestCmd(t, azureClient, testDetails)
}

func TestAzureRepos_ScanRepositoryIntegration(t *testing.T) {
azureClient, testDetails := azureReposTestsInit(t, false)
runScanRepositoryCmd(t, azureClient, testDetails)
}

func TestAzureRepos_ScanRepositoryWithLocalDirIntegration(t *testing.T) {
azureClient, testDetails := azureReposTestsInit(t, true)
azureClient, testDetails := azureReposTestsInit(t)
runScanRepositoryCmd(t, azureClient, testDetails)
}
20 changes: 9 additions & 11 deletions bitbucket_server_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build integration

package main

import (
Expand Down Expand Up @@ -27,9 +29,9 @@ func buildBitbucketServerClient(t *testing.T, bitbucketServerToken string) vcscl
return bbClient
}

func buildBitbucketServerIntegrationTestDetails(t *testing.T, useLocalRepo bool) *IntegrationTestDetails {
func buildBitbucketServerIntegrationTestDetails(t *testing.T) *IntegrationTestDetails {
integrationRepoToken := getIntegrationToken(t, bitbucketServerIntegrationTokenEnv)
testDetails := NewIntegrationTestDetails(integrationRepoToken, string(utils.BitbucketServer), bitbucketServerGitCloneUrl, "FROG", useLocalRepo)
testDetails := NewIntegrationTestDetails(integrationRepoToken, string(utils.BitbucketServer), bitbucketServerGitCloneUrl, "FROG")
testDetails.ApiEndpoint = bitbucketServerApiEndpoint
return testDetails
}
Expand All @@ -54,24 +56,20 @@ func waitForConnection(t *testing.T) {
require.NoError(t, retryExecutor.Execute())
}

func bitbucketServerTestsInit(t *testing.T, useLocalRepo bool) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildBitbucketServerIntegrationTestDetails(t, useLocalRepo)
func bitbucketServerTestsInit(t *testing.T) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildBitbucketServerIntegrationTestDetails(t)
bbClient := buildBitbucketServerClient(t, testDetails.GitToken)
waitForConnection(t)
return bbClient, testDetails
}

func TestBitbucketServer_ScanPullRequestIntegration(t *testing.T) {
bbClient, testDetails := bitbucketServerTestsInit(t, false)
t.Fail()
bbClient, testDetails := bitbucketServerTestsInit(t)
runScanPullRequestCmd(t, bbClient, testDetails)
}

func TestBitbucketServer_ScanRepositoryIntegration(t *testing.T) {
bbClient, testDetails := bitbucketServerTestsInit(t, false)
runScanRepositoryCmd(t, bbClient, testDetails)
}

func TestBitbucketServer_ScanRepositoryWithLocalDirIntegration(t *testing.T) {
bbClient, testDetails := bitbucketServerTestsInit(t, true)
bbClient, testDetails := bitbucketServerTestsInit(t)
runScanRepositoryCmd(t, bbClient, testDetails)
}
28 changes: 14 additions & 14 deletions github_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
//go:build integration

package main

import (
"testing"

"github.com/jfrog/frogbot/v2/utils"
"github.com/jfrog/froggit-go/vcsclient"
"github.com/jfrog/froggit-go/vcsutils"
"github.com/stretchr/testify/assert"
"testing"
)

const (
//#nosec G101 -- False positive - no hardcoded credentials.
githubIntegrationTokenEnv = "FROGBOT_TESTS_GITHUB_TOKEN"
githubGitCloneUrl = "https://github.com/frogbot-test/integration.git"
githubIntegrationTokenEnv = "FROGBOT_V3_TESTS_GITHUB_TOKEN"
githubGitCloneUrl = "https://github.com/frogbot-e2e-test/frogbot-test.git"
githubRepoOwner = "frogbot-e2e-test"
)

func buildGitHubClient(t *testing.T, githubToken string) vcsclient.VcsClient {
Expand All @@ -20,28 +24,24 @@ func buildGitHubClient(t *testing.T, githubToken string) vcsclient.VcsClient {
return githubClient
}

func buildGitHubIntegrationTestDetails(t *testing.T, useLocalRepo bool) *IntegrationTestDetails {
func buildGitHubIntegrationTestDetails(t *testing.T) *IntegrationTestDetails {
integrationRepoToken := getIntegrationToken(t, githubIntegrationTokenEnv)
return NewIntegrationTestDetails(integrationRepoToken, string(utils.GitHub), githubGitCloneUrl, "frogbot-test", useLocalRepo)
return NewIntegrationTestDetails(integrationRepoToken, string(utils.GitHub), githubGitCloneUrl, githubRepoOwner)
}

func githubTestsInit(t *testing.T, useLocalRepo bool) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildGitHubIntegrationTestDetails(t, useLocalRepo)
func githubTestsInit(t *testing.T) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildGitHubIntegrationTestDetails(t)
githubClient := buildGitHubClient(t, testDetails.GitToken)
return githubClient, testDetails
}

func TestGitHub_ScanPullRequestIntegration(t *testing.T) {
githubClient, testDetails := githubTestsInit(t, false)
t.Fail()
githubClient, testDetails := githubTestsInit(t)
runScanPullRequestCmd(t, githubClient, testDetails)
}

func TestGitHub_ScanRepositoryIntegration(t *testing.T) {
githubClient, testDetails := githubTestsInit(t, false)
runScanRepositoryCmd(t, githubClient, testDetails)
}

func TestGitHub_ScanRepositoryWithLocalDirIntegration(t *testing.T) {
githubClient, testDetails := githubTestsInit(t, true)
githubClient, testDetails := githubTestsInit(t)
runScanRepositoryCmd(t, githubClient, testDetails)
}
28 changes: 14 additions & 14 deletions gitlab_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
//go:build integration

package main

import (
"testing"

"github.com/jfrog/frogbot/v2/utils"
"github.com/jfrog/froggit-go/vcsclient"
"github.com/jfrog/froggit-go/vcsutils"
"github.com/stretchr/testify/assert"
"testing"
)

const (
//#nosec G101 -- False positive - no hardcoded credentials.
gitlabIntegrationTokenEnv = "FROGBOT_TESTS_GITLAB_TOKEN"
gitlabGitCloneUrl = "https://gitlab.com/frogbot-test2/integration.git"
gitlabIntegrationTokenEnv = "FROGBOT_V3_TESTS_GITLAB_TOKEN"
gitlabGitCloneUrl = "https://gitlab.com/frogbot-e2e-test1/frogbot-test.git"
gitlabRepoOwner = "frogbot-e2e-test1"
)

func buildGitLabClient(t *testing.T, gitlabToken string) vcsclient.VcsClient {
Expand All @@ -20,28 +24,24 @@ func buildGitLabClient(t *testing.T, gitlabToken string) vcsclient.VcsClient {
return azureClient
}

func buildGitLabIntegrationTestDetails(t *testing.T, useLocalRepo bool) *IntegrationTestDetails {
func buildGitLabIntegrationTestDetails(t *testing.T) *IntegrationTestDetails {
integrationRepoToken := getIntegrationToken(t, gitlabIntegrationTokenEnv)
return NewIntegrationTestDetails(integrationRepoToken, string(utils.GitLab), gitlabGitCloneUrl, "frogbot-test2", useLocalRepo)
return NewIntegrationTestDetails(integrationRepoToken, string(utils.GitLab), gitlabGitCloneUrl, gitlabRepoOwner)
}

func gitlabTestsInit(t *testing.T, useLocalRepo bool) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildGitLabIntegrationTestDetails(t, useLocalRepo)
func gitlabTestsInit(t *testing.T) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildGitLabIntegrationTestDetails(t)
gitlabClient := buildGitLabClient(t, testDetails.GitToken)
return gitlabClient, testDetails
}

func TestGitLab_ScanPullRequestIntegration(t *testing.T) {
gitlabClient, testDetails := gitlabTestsInit(t, false)
t.Fail()
gitlabClient, testDetails := gitlabTestsInit(t)
runScanPullRequestCmd(t, gitlabClient, testDetails)
}

func TestGitLab_ScanRepositoryIntegration(t *testing.T) {
gitlabClient, testDetails := gitlabTestsInit(t, false)
runScanRepositoryCmd(t, gitlabClient, testDetails)
}

func TestGitLab_ScanRepositoryWithLocalDirIntegration(t *testing.T) {
gitlabClient, testDetails := gitlabTestsInit(t, true)
gitlabClient, testDetails := gitlabTestsInit(t)
runScanRepositoryCmd(t, gitlabClient, testDetails)
}
Loading
Loading