-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(codeqlExecuteScan): cloning project from non-github scm to github …
…#4630 Co-authored-by: sumeet patil <[email protected]>
- Loading branch information
1 parent
49f4c81
commit 6331d1b
Showing
8 changed files
with
888 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,7 +180,8 @@ func TestGetGitRepoInfo(t *testing.T) { | |
func TestInitGitInfo(t *testing.T) { | ||
t.Run("Valid URL1", func(t *testing.T) { | ||
config := codeqlExecuteScanOptions{Repository: "https://github.hello.test/Testing/codeql.git", AnalyzedRef: "refs/head/branch", CommitID: "abcd1234"} | ||
repoInfo := initGitInfo(&config) | ||
repoInfo, err := initGitInfo(&config) | ||
assert.NoError(t, err) | ||
assert.Equal(t, "abcd1234", repoInfo.commitId) | ||
assert.Equal(t, "Testing", repoInfo.owner) | ||
assert.Equal(t, "codeql", repoInfo.repo) | ||
|
@@ -190,7 +191,8 @@ func TestInitGitInfo(t *testing.T) { | |
|
||
t.Run("Valid URL2", func(t *testing.T) { | ||
config := codeqlExecuteScanOptions{Repository: "https://github.hello.test/Testing/codeql", AnalyzedRef: "refs/head/branch", CommitID: "abcd1234"} | ||
repoInfo := initGitInfo(&config) | ||
repoInfo, err := initGitInfo(&config) | ||
assert.NoError(t, err) | ||
assert.Equal(t, "abcd1234", repoInfo.commitId) | ||
assert.Equal(t, "Testing", repoInfo.owner) | ||
assert.Equal(t, "codeql", repoInfo.repo) | ||
|
@@ -200,7 +202,8 @@ func TestInitGitInfo(t *testing.T) { | |
|
||
t.Run("Valid url with dots URL1", func(t *testing.T) { | ||
config := codeqlExecuteScanOptions{Repository: "https://github.hello.test/Testing/com.sap.codeql.git", AnalyzedRef: "refs/head/branch", CommitID: "abcd1234"} | ||
repoInfo := initGitInfo(&config) | ||
repoInfo, err := initGitInfo(&config) | ||
assert.NoError(t, err) | ||
assert.Equal(t, "abcd1234", repoInfo.commitId) | ||
assert.Equal(t, "Testing", repoInfo.owner) | ||
assert.Equal(t, "com.sap.codeql", repoInfo.repo) | ||
|
@@ -210,7 +213,8 @@ func TestInitGitInfo(t *testing.T) { | |
|
||
t.Run("Valid url with dots URL2", func(t *testing.T) { | ||
config := codeqlExecuteScanOptions{Repository: "https://github.hello.test/Testing/com.sap.codeql", AnalyzedRef: "refs/head/branch", CommitID: "abcd1234"} | ||
repoInfo := initGitInfo(&config) | ||
repoInfo, err := initGitInfo(&config) | ||
assert.NoError(t, err) | ||
assert.Equal(t, "abcd1234", repoInfo.commitId) | ||
assert.Equal(t, "Testing", repoInfo.owner) | ||
assert.Equal(t, "com.sap.codeql", repoInfo.repo) | ||
|
@@ -220,7 +224,8 @@ func TestInitGitInfo(t *testing.T) { | |
|
||
t.Run("Valid url with username and token URL1", func(t *testing.T) { | ||
config := codeqlExecuteScanOptions{Repository: "https://username:[email protected]/Testing/codeql.git", AnalyzedRef: "refs/head/branch", CommitID: "abcd1234"} | ||
repoInfo := initGitInfo(&config) | ||
repoInfo, err := initGitInfo(&config) | ||
assert.NoError(t, err) | ||
assert.Equal(t, "abcd1234", repoInfo.commitId) | ||
assert.Equal(t, "Testing", repoInfo.owner) | ||
assert.Equal(t, "codeql", repoInfo.repo) | ||
|
@@ -230,7 +235,8 @@ func TestInitGitInfo(t *testing.T) { | |
|
||
t.Run("Valid url with username and token URL2", func(t *testing.T) { | ||
config := codeqlExecuteScanOptions{Repository: "https://username:[email protected]/Testing/codeql", AnalyzedRef: "refs/head/branch", CommitID: "abcd1234"} | ||
repoInfo := initGitInfo(&config) | ||
repoInfo, err := initGitInfo(&config) | ||
assert.NoError(t, err) | ||
assert.Equal(t, "abcd1234", repoInfo.commitId) | ||
assert.Equal(t, "Testing", repoInfo.owner) | ||
assert.Equal(t, "codeql", repoInfo.repo) | ||
|
@@ -240,8 +246,9 @@ func TestInitGitInfo(t *testing.T) { | |
|
||
t.Run("Invalid URL with no org/reponame", func(t *testing.T) { | ||
config := codeqlExecuteScanOptions{Repository: "https://github.hello.test", AnalyzedRef: "refs/head/branch", CommitID: "abcd1234"} | ||
repoInfo := initGitInfo(&config) | ||
_, err := orchestrator.NewOrchestratorSpecificConfigProvider() | ||
repoInfo, err := initGitInfo(&config) | ||
assert.NoError(t, err) | ||
_, err = orchestrator.NewOrchestratorSpecificConfigProvider() | ||
assert.Equal(t, "abcd1234", repoInfo.commitId) | ||
assert.Equal(t, "refs/head/branch", repoInfo.ref) | ||
if err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.