forked from jfrog/jfrog-cli-security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxsc_test.go
31 lines (26 loc) · 1.06 KB
/
xsc_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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"))
}