-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fd91af
commit e1c3a33
Showing
3 changed files
with
34 additions
and
26 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
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"errors" | ||
"github.com/jfrog/jfrog-cli-core/v2/utils/config" | ||
"github.com/jfrog/jfrog-cli-security/tests" | ||
"github.com/jfrog/jfrog-cli-security/utils" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestReportError(t *testing.T) { | ||
serverDetails := &config.ServerDetails{ | ||
Url: *tests.JfrogUrl, | ||
ArtifactoryUrl: *tests.JfrogUrl + tests.ArtifactoryEndpoint, | ||
XrayUrl: *tests.JfrogUrl + tests.XrayEndpoint, | ||
AccessToken: *tests.JfrogAccessToken, | ||
ServerId: tests.ServerId, | ||
} | ||
|
||
// Prior to initiating the test, we verify whether Xsc is enabled for the customer. If not, the test is skipped. | ||
xscManager, err := utils.CreateXscServiceManager(serverDetails) | ||
assert.NoError(t, err) | ||
|
||
if !utils.IsReportLogErrorEventPossible(xscManager) { | ||
t.Skip("Skipping test since Xsc server is not enabled or below minimal required version") | ||
} | ||
|
||
errorToReport := errors.New("THIS IS NOT A REAL ERROR! This Error is posted as part of TestReportError test") | ||
assert.NoError(t, utils.ReportError(serverDetails, errorToReport, "cli")) | ||
} |