mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-03 15:02:35 +02:00
xsDeploy: check for operationId in go layer and return error in case it is missing (#1109)
This commit is contained in:
parent
b4de8f2950
commit
161e0b5d3b
@ -265,6 +265,9 @@ func runXsDeploy(XsDeployOptions xsDeployOptions, s shellRunner,
|
||||
|
||||
if err == nil && (mode == BGDeploy && action == None) {
|
||||
XsDeployOptions.OperationID = retrieveOperationID(o, XsDeployOptions.OperationIDLogPattern)
|
||||
if len(XsDeployOptions.OperationID) == 0 {
|
||||
err = errors.New("No operationID found")
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
@ -182,8 +182,12 @@ func TestDeploy(t *testing.T) {
|
||||
fileUtilsMock.copiedFiles = nil
|
||||
removedFiles = nil
|
||||
s.Calls = nil
|
||||
s.StdoutReturn = make(map[string]string)
|
||||
}()
|
||||
|
||||
s.StdoutReturn = make(map[string]string)
|
||||
s.StdoutReturn[".*xs bg-deploy.*"] = "Use \"xs bg-deploy -i 1234 -a resume\" to resume the process.\n"
|
||||
|
||||
oldMode := myXsDeployOptions.Mode
|
||||
|
||||
defer func() {
|
||||
@ -200,6 +204,30 @@ func TestDeploy(t *testing.T) {
|
||||
assert.Len(t, s.Calls, 2) // There are two entries --> no logout in this case.
|
||||
})
|
||||
|
||||
t.Run("BG deploy fails, missing operationID", func(t *testing.T) {
|
||||
|
||||
defer func() {
|
||||
fileUtilsMock.copiedFiles = nil
|
||||
removedFiles = nil
|
||||
s.Calls = nil
|
||||
s.StdoutReturn = make(map[string]string)
|
||||
}()
|
||||
|
||||
s.StdoutReturn = make(map[string]string)
|
||||
s.StdoutReturn[".*xs bg-deploy.*"] = "There is no operation id\n"
|
||||
|
||||
oldMode := myXsDeployOptions.Mode
|
||||
|
||||
defer func() {
|
||||
myXsDeployOptions.Mode = oldMode
|
||||
}()
|
||||
|
||||
myXsDeployOptions.Mode = "BG_DEPLOY"
|
||||
|
||||
e := runXsDeploy(myXsDeployOptions, &s, &fileUtilsMock, fRemove, ioutil.Discard)
|
||||
checkErr(t, e, "No operationID found")
|
||||
})
|
||||
|
||||
t.Run("BG deploy abort succeeds", func(t *testing.T) {
|
||||
|
||||
defer func() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user