mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-04-11 11:41:53 +02:00
new step integrationArtifactTriggerIntegrationTest (#2951)
* new step integrationArtifactTriggerIntegrationTest * add new step into allow list * add the new step to main command * refer cpe * remove unused unit tests * Check methods and URLs of http request * Add TriggerIntegration to mockingutils * Format code Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> Co-authored-by: Linda Siebert <linda.siebert@sap.com>
This commit is contained in:
parent
90d0baa56f
commit
7910df0e8c
156
cmd/integrationArtifactTriggerIntegrationTest.go
Normal file
156
cmd/integrationArtifactTriggerIntegrationTest.go
Normal file
@ -0,0 +1,156 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/SAP/jenkins-library/pkg/command"
|
||||
"github.com/SAP/jenkins-library/pkg/cpi"
|
||||
piperhttp "github.com/SAP/jenkins-library/pkg/http"
|
||||
"github.com/SAP/jenkins-library/pkg/log"
|
||||
"github.com/SAP/jenkins-library/pkg/piperutils"
|
||||
"github.com/SAP/jenkins-library/pkg/telemetry"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type integrationArtifactTriggerIntegrationTestUtils interface {
|
||||
command.ExecRunner
|
||||
|
||||
FileExists(filename string) (bool, error)
|
||||
|
||||
// Add more methods here, or embed additional interfaces, or remove/replace as required.
|
||||
// The integrationArtifactTriggerIntegrationTestUtils interface should be descriptive of your runtime dependencies,
|
||||
// i.e. include everything you need to be able to mock in tests.
|
||||
// Unit tests shall be executable in parallel (not depend on global state), and don't (re-)test dependencies.
|
||||
}
|
||||
|
||||
type integrationArtifactTriggerIntegrationTestUtilsBundle struct {
|
||||
*command.Command
|
||||
*piperutils.Files
|
||||
|
||||
// Embed more structs as necessary to implement methods or interfaces you add to integrationArtifactTriggerIntegrationTestUtils.
|
||||
// Structs embedded in this way must each have a unique set of methods attached.
|
||||
// If there is no struct which implements the method you need, attach the method to
|
||||
// integrationArtifactTriggerIntegrationTestUtilsBundle and forward to the implementation of the dependency.
|
||||
}
|
||||
|
||||
func newIntegrationArtifactTriggerIntegrationTestUtils() integrationArtifactTriggerIntegrationTestUtils {
|
||||
utils := integrationArtifactTriggerIntegrationTestUtilsBundle{
|
||||
Command: &command.Command{},
|
||||
Files: &piperutils.Files{},
|
||||
}
|
||||
// Reroute command output to logging framework
|
||||
utils.Stdout(log.Writer())
|
||||
utils.Stderr(log.Writer())
|
||||
return &utils
|
||||
}
|
||||
|
||||
func integrationArtifactTriggerIntegrationTest(config integrationArtifactTriggerIntegrationTestOptions, telemetryData *telemetry.CustomData) {
|
||||
// Utils can be used wherever the command.ExecRunner interface is expected.
|
||||
// It can also be used for example as a mavenExecRunner.
|
||||
utils := newIntegrationArtifactTriggerIntegrationTestUtils()
|
||||
httpClient := &piperhttp.Client{}
|
||||
// For HTTP calls import piperhttp "github.com/SAP/jenkins-library/pkg/http"
|
||||
// and use a &piperhttp.Client{} in a custom system
|
||||
// Example: step checkmarxExecuteScan.go
|
||||
|
||||
// Error situations should be bubbled up until they reach the line below which will then stop execution
|
||||
// through the log.Entry().Fatal() call leading to an os.Exit(1) in the end.
|
||||
err := runIntegrationArtifactTriggerIntegrationTest(&config, telemetryData, utils, httpClient)
|
||||
if err != nil {
|
||||
log.Entry().WithError(err).Fatal("step execution failed")
|
||||
}
|
||||
}
|
||||
|
||||
func runIntegrationArtifactTriggerIntegrationTest(config *integrationArtifactTriggerIntegrationTestOptions, telemetryData *telemetry.CustomData, utils integrationArtifactTriggerIntegrationTestUtils, httpClient piperhttp.Sender) error {
|
||||
var commonPipelineEnvironment integrationArtifactGetServiceEndpointCommonPipelineEnvironment
|
||||
var serviceEndpointUrl string
|
||||
if len(config.IFlowServiceEndpointURL) > 0 {
|
||||
serviceEndpointUrl = config.IFlowServiceEndpointURL
|
||||
} else {
|
||||
serviceEndpointUrl = commonPipelineEnvironment.custom.iFlowServiceEndpoint
|
||||
if len(serviceEndpointUrl) == 0 {
|
||||
log.SetErrorCategory(log.ErrorConfiguration)
|
||||
return fmt.Errorf("IFlowServiceEndpointURL not set")
|
||||
}
|
||||
}
|
||||
log.Entry().Info("The Service URL : ", serviceEndpointUrl)
|
||||
|
||||
// Here we trigger the iFlow Service Endpoint.
|
||||
IFlowErr := callIFlowURL(config, telemetryData, utils, httpClient, serviceEndpointUrl)
|
||||
if IFlowErr != nil {
|
||||
log.SetErrorCategory(log.ErrorService)
|
||||
return fmt.Errorf("failed to execute iFlow: %w", IFlowErr)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func callIFlowURL(config *integrationArtifactTriggerIntegrationTestOptions, telemetryData *telemetry.CustomData, utils integrationArtifactTriggerIntegrationTestUtils, httpIFlowClient piperhttp.Sender, serviceEndpointUrl string) error {
|
||||
|
||||
var fileBody []byte
|
||||
var httpMethod string
|
||||
var header http.Header
|
||||
if len(config.MessageBodyPath) > 0 {
|
||||
if len(config.ContentType) == 0 {
|
||||
log.SetErrorCategory(log.ErrorConfiguration)
|
||||
return fmt.Errorf("message body file %s given, but no ContentType", config.MessageBodyPath)
|
||||
}
|
||||
exists, err := utils.FileExists(config.MessageBodyPath)
|
||||
if err != nil {
|
||||
log.SetErrorCategory(log.ErrorUndefined)
|
||||
// Always wrap non-descriptive errors to enrich them with context for when they appear in the log:
|
||||
return fmt.Errorf("failed to check message body file %s: %w", config.MessageBodyPath, err)
|
||||
}
|
||||
if !exists {
|
||||
log.SetErrorCategory(log.ErrorConfiguration)
|
||||
return fmt.Errorf("message body file %s configured, but not found", config.MessageBodyPath)
|
||||
}
|
||||
|
||||
var fileErr error
|
||||
fileBody, fileErr = ioutil.ReadFile(config.MessageBodyPath)
|
||||
if fileErr != nil {
|
||||
log.SetErrorCategory(log.ErrorUndefined)
|
||||
return fmt.Errorf("failed to read file %s: %w", config.MessageBodyPath, fileErr)
|
||||
}
|
||||
httpMethod = "POST"
|
||||
header = make(http.Header)
|
||||
header.Add("Content-Type", config.ContentType)
|
||||
} else {
|
||||
httpMethod = "GET"
|
||||
}
|
||||
|
||||
serviceKey, err := cpi.ReadCpiServiceKey(config.IFlowServiceKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
clientOptions := piperhttp.ClientOptions{}
|
||||
tokenParameters := cpi.TokenParameters{TokenURL: serviceKey.OAuth.OAuthTokenProviderURL, Username: serviceKey.OAuth.ClientID, Password: serviceKey.OAuth.ClientSecret, Client: httpIFlowClient}
|
||||
token, err := cpi.CommonUtils.GetBearerToken(tokenParameters)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to fetch Bearer Token")
|
||||
}
|
||||
clientOptions.Token = fmt.Sprintf("Bearer %s", token)
|
||||
httpIFlowClient.SetOptions(clientOptions)
|
||||
iFlowResp, httpErr := httpIFlowClient.SendRequest(httpMethod, serviceEndpointUrl, bytes.NewBuffer(fileBody), header, nil)
|
||||
|
||||
if httpErr != nil {
|
||||
return errors.Wrapf(httpErr, "HTTP %q request to %q failed with error", httpMethod, serviceEndpointUrl)
|
||||
}
|
||||
|
||||
if iFlowResp == nil {
|
||||
return errors.Errorf("did not retrieve any HTTP response")
|
||||
}
|
||||
|
||||
if iFlowResp.StatusCode < 400 {
|
||||
log.Entry().
|
||||
WithField(config.IntegrationFlowID, serviceEndpointUrl).
|
||||
Infof("successfully triggered %s with status code %d", serviceEndpointUrl, iFlowResp.StatusCode)
|
||||
} else {
|
||||
return fmt.Errorf("request %s failed with response code %d", serviceEndpointUrl, iFlowResp.StatusCode)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
196
cmd/integrationArtifactTriggerIntegrationTest_generated.go
Normal file
196
cmd/integrationArtifactTriggerIntegrationTest_generated.go
Normal file
@ -0,0 +1,196 @@
|
||||
// Code generated by piper's step-generator. DO NOT EDIT.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/SAP/jenkins-library/pkg/config"
|
||||
"github.com/SAP/jenkins-library/pkg/log"
|
||||
"github.com/SAP/jenkins-library/pkg/splunk"
|
||||
"github.com/SAP/jenkins-library/pkg/telemetry"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type integrationArtifactTriggerIntegrationTestOptions struct {
|
||||
IFlowServiceKey string `json:"iFlowServiceKey,omitempty"`
|
||||
IntegrationFlowID string `json:"integrationFlowId,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
IFlowServiceEndpointURL string `json:"iFlowServiceEndpointUrl,omitempty"`
|
||||
ContentType string `json:"contentType,omitempty"`
|
||||
MessageBodyPath string `json:"messageBodyPath,omitempty"`
|
||||
}
|
||||
|
||||
// IntegrationArtifactTriggerIntegrationTestCommand Test the service endpoint of your iFlow
|
||||
func IntegrationArtifactTriggerIntegrationTestCommand() *cobra.Command {
|
||||
const STEP_NAME = "integrationArtifactTriggerIntegrationTest"
|
||||
|
||||
metadata := integrationArtifactTriggerIntegrationTestMetadata()
|
||||
var stepConfig integrationArtifactTriggerIntegrationTestOptions
|
||||
var startTime time.Time
|
||||
var logCollector *log.CollectorHook
|
||||
|
||||
var createIntegrationArtifactTriggerIntegrationTestCmd = &cobra.Command{
|
||||
Use: STEP_NAME,
|
||||
Short: "Test the service endpoint of your iFlow",
|
||||
Long: `With this step you can test your intergration flow exposed by SAP Cloud Platform Integration on a tenant using OData API.Learn more about the SAP Cloud Integration remote API for getting service endpoint of deployed integration artifact [here](https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/d1679a80543f46509a7329243b595bdb.html).`,
|
||||
PreRunE: func(cmd *cobra.Command, _ []string) error {
|
||||
startTime = time.Now()
|
||||
log.SetStepName(STEP_NAME)
|
||||
log.SetVerbose(GeneralConfig.Verbose)
|
||||
|
||||
path, _ := os.Getwd()
|
||||
fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path}
|
||||
log.RegisterHook(fatalHook)
|
||||
|
||||
err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile)
|
||||
if err != nil {
|
||||
log.SetErrorCategory(log.ErrorConfiguration)
|
||||
return err
|
||||
}
|
||||
log.RegisterSecret(stepConfig.IFlowServiceKey)
|
||||
|
||||
if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 {
|
||||
sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID)
|
||||
log.RegisterHook(&sentryHook)
|
||||
}
|
||||
|
||||
if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
|
||||
logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID}
|
||||
log.RegisterHook(logCollector)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
telemetryData := telemetry.CustomData{}
|
||||
telemetryData.ErrorCode = "1"
|
||||
handler := func() {
|
||||
config.RemoveVaultSecretFiles()
|
||||
telemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds())
|
||||
telemetryData.ErrorCategory = log.GetErrorCategory().String()
|
||||
telemetry.Send(&telemetryData)
|
||||
if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
|
||||
splunk.Send(&telemetryData, logCollector)
|
||||
}
|
||||
}
|
||||
log.DeferExitHandler(handler)
|
||||
defer handler()
|
||||
telemetry.Initialize(GeneralConfig.NoTelemetry, STEP_NAME)
|
||||
if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 {
|
||||
splunk.Initialize(GeneralConfig.CorrelationID,
|
||||
GeneralConfig.HookConfig.SplunkConfig.Dsn,
|
||||
GeneralConfig.HookConfig.SplunkConfig.Token,
|
||||
GeneralConfig.HookConfig.SplunkConfig.Index,
|
||||
GeneralConfig.HookConfig.SplunkConfig.SendLogs)
|
||||
}
|
||||
integrationArtifactTriggerIntegrationTest(stepConfig, &telemetryData)
|
||||
telemetryData.ErrorCode = "0"
|
||||
log.Entry().Info("SUCCESS")
|
||||
},
|
||||
}
|
||||
|
||||
addIntegrationArtifactTriggerIntegrationTestFlags(createIntegrationArtifactTriggerIntegrationTestCmd, &stepConfig)
|
||||
return createIntegrationArtifactTriggerIntegrationTestCmd
|
||||
}
|
||||
|
||||
func addIntegrationArtifactTriggerIntegrationTestFlags(cmd *cobra.Command, stepConfig *integrationArtifactTriggerIntegrationTestOptions) {
|
||||
cmd.Flags().StringVar(&stepConfig.IFlowServiceKey, "iFlowServiceKey", os.Getenv("PIPER_iFlowServiceKey"), "User to authenticate to the SAP Cloud Platform Integration Service")
|
||||
cmd.Flags().StringVar(&stepConfig.IntegrationFlowID, "integrationFlowId", os.Getenv("PIPER_integrationFlowId"), "Specifies the ID of the Integration Flow artifact")
|
||||
cmd.Flags().StringVar(&stepConfig.Platform, "platform", `cf`, "Specifies the running platform of the SAP Cloud platform integraion service")
|
||||
cmd.Flags().StringVar(&stepConfig.IFlowServiceEndpointURL, "iFlowServiceEndpointUrl", os.Getenv("PIPER_iFlowServiceEndpointUrl"), "Specifies the URL endpoint of the iFlow. Please provide in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.")
|
||||
cmd.Flags().StringVar(&stepConfig.ContentType, "contentType", os.Getenv("PIPER_contentType"), "Specifies the content type of the file defined in messageBodyPath e.g. application/json")
|
||||
cmd.Flags().StringVar(&stepConfig.MessageBodyPath, "messageBodyPath", os.Getenv("PIPER_messageBodyPath"), "Speficfies the relative file path to the message body.")
|
||||
|
||||
cmd.MarkFlagRequired("iFlowServiceKey")
|
||||
cmd.MarkFlagRequired("integrationFlowId")
|
||||
cmd.MarkFlagRequired("iFlowServiceEndpointUrl")
|
||||
}
|
||||
|
||||
// retrieve step metadata
|
||||
func integrationArtifactTriggerIntegrationTestMetadata() config.StepData {
|
||||
var theMetaData = config.StepData{
|
||||
Metadata: config.StepMetadata{
|
||||
Name: "integrationArtifactTriggerIntegrationTest",
|
||||
Aliases: []config.Alias{},
|
||||
Description: "Test the service endpoint of your iFlow",
|
||||
},
|
||||
Spec: config.StepSpec{
|
||||
Inputs: config.StepInputs{
|
||||
Secrets: []config.StepSecrets{
|
||||
{Name: "iFlowCredentialsId", Description: "Jenkins credentials ID containing username and password for authentication to the SAP Cloud Platform Integration API's", Type: "jenkins"},
|
||||
},
|
||||
Parameters: []config.StepParameters{
|
||||
{
|
||||
Name: "iFlowServiceKey",
|
||||
ResourceRef: []config.ResourceReference{
|
||||
{
|
||||
Name: "iFlowCredentialsId",
|
||||
Param: "iFlowServiceKey",
|
||||
Type: "secret",
|
||||
},
|
||||
},
|
||||
Scope: []string{"PARAMETERS"},
|
||||
Type: "string",
|
||||
Mandatory: true,
|
||||
Aliases: []config.Alias{},
|
||||
Default: os.Getenv("PIPER_iFlowServiceKey"),
|
||||
},
|
||||
{
|
||||
Name: "integrationFlowId",
|
||||
ResourceRef: []config.ResourceReference{},
|
||||
Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"},
|
||||
Type: "string",
|
||||
Mandatory: true,
|
||||
Aliases: []config.Alias{},
|
||||
Default: os.Getenv("PIPER_integrationFlowId"),
|
||||
},
|
||||
{
|
||||
Name: "platform",
|
||||
ResourceRef: []config.ResourceReference{},
|
||||
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
|
||||
Type: "string",
|
||||
Mandatory: false,
|
||||
Aliases: []config.Alias{},
|
||||
Default: `cf`,
|
||||
},
|
||||
{
|
||||
Name: "iFlowServiceEndpointUrl",
|
||||
ResourceRef: []config.ResourceReference{
|
||||
{
|
||||
Name: "commonPipelineEnvironment",
|
||||
Param: "custom/iFlowServiceEndpoint",
|
||||
},
|
||||
},
|
||||
Scope: []string{"PARAMETERS"},
|
||||
Type: "string",
|
||||
Mandatory: true,
|
||||
Aliases: []config.Alias{},
|
||||
Default: os.Getenv("PIPER_iFlowServiceEndpointUrl"),
|
||||
},
|
||||
{
|
||||
Name: "contentType",
|
||||
ResourceRef: []config.ResourceReference{},
|
||||
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
|
||||
Type: "string",
|
||||
Mandatory: false,
|
||||
Aliases: []config.Alias{},
|
||||
Default: os.Getenv("PIPER_contentType"),
|
||||
},
|
||||
{
|
||||
Name: "messageBodyPath",
|
||||
ResourceRef: []config.ResourceReference{},
|
||||
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
|
||||
Type: "string",
|
||||
Mandatory: false,
|
||||
Aliases: []config.Alias{},
|
||||
Default: os.Getenv("PIPER_messageBodyPath"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
return theMetaData
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIntegrationArtifactTriggerIntegrationTestCommand(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCmd := IntegrationArtifactTriggerIntegrationTestCommand()
|
||||
|
||||
// only high level testing performed - details are tested in step generation procedure
|
||||
assert.Equal(t, "integrationArtifactTriggerIntegrationTest", testCmd.Use, "command name incorrect")
|
||||
|
||||
}
|
185
cmd/integrationArtifactTriggerIntegrationTest_test.go
Normal file
185
cmd/integrationArtifactTriggerIntegrationTest_test.go
Normal file
@ -0,0 +1,185 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/SAP/jenkins-library/pkg/mock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type integrationArtifactTriggerIntegrationTestMockUtils struct {
|
||||
*mock.ExecMockRunner
|
||||
*mock.FilesMock
|
||||
}
|
||||
|
||||
func newIntegrationArtifactTriggerIntegrationTestTestsUtils() integrationArtifactTriggerIntegrationTestMockUtils {
|
||||
utils := integrationArtifactTriggerIntegrationTestMockUtils{
|
||||
ExecMockRunner: &mock.ExecMockRunner{},
|
||||
FilesMock: &mock.FilesMock{},
|
||||
}
|
||||
return utils
|
||||
}
|
||||
|
||||
func TestRunIntegrationArtifactTriggerIntegrationTest(t *testing.T) {
|
||||
t.Run("MessageBodyPath good but no ContentType (ERROR) callIFlowURL", func(t *testing.T) {
|
||||
//init
|
||||
iFlowServiceKey := `{
|
||||
"oauth": {
|
||||
"url": "https://demo",
|
||||
"clientid": "demouser",
|
||||
"clientsecret": "******",
|
||||
"tokenurl": "https://demo/oauth/token"
|
||||
}
|
||||
}`
|
||||
config := integrationArtifactTriggerIntegrationTestOptions{
|
||||
IFlowServiceKey: iFlowServiceKey,
|
||||
IntegrationFlowID: "CPI_IFlow_Call_using_Cert",
|
||||
Platform: "cf",
|
||||
MessageBodyPath: "/file.txt",
|
||||
ContentType: "",
|
||||
}
|
||||
|
||||
utils := newIntegrationArtifactTriggerIntegrationTestTestsUtils()
|
||||
utils.AddFile("file.txt", []byte("dummycontent"))
|
||||
httpClient := httpMockCpis{CPIFunction: "TriggerIntegrationTest", ResponseBody: ``, TestType: "Positive"}
|
||||
|
||||
//test
|
||||
err := callIFlowURL(&config, nil, utils, &httpClient, "")
|
||||
|
||||
//assert
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("MessageBodyPath and ContentType good but file missing (ERROR) callIFlowURL", func(t *testing.T) {
|
||||
//init
|
||||
iFlowServiceKey := `{
|
||||
"oauth": {
|
||||
"url": "https://demo",
|
||||
"clientid": "demouser",
|
||||
"clientsecret": "******",
|
||||
"tokenurl": "https://demo/oauth/token"
|
||||
}
|
||||
}`
|
||||
config := integrationArtifactTriggerIntegrationTestOptions{
|
||||
IFlowServiceKey: iFlowServiceKey,
|
||||
IntegrationFlowID: "CPI_IFlow_Call_using_Cert",
|
||||
Platform: "cf",
|
||||
MessageBodyPath: "test.txt",
|
||||
ContentType: "txt",
|
||||
}
|
||||
|
||||
utils := newIntegrationArtifactTriggerIntegrationTestTestsUtils()
|
||||
//no file created here. error expected
|
||||
httpClient := httpMockCpis{CPIFunction: "TriggerIntegrationTest", ResponseBody: ``, TestType: "Positive"}
|
||||
|
||||
//test
|
||||
err := callIFlowURL(&config, nil, utils, &httpClient, "")
|
||||
|
||||
//assert
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("MessageBodyPath, ContentType, and file good (SUCCESS) callIFlowURL", func(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
defer os.RemoveAll(dir) // clean up
|
||||
assert.NoError(t, err, "Error when creating temp dir")
|
||||
//init
|
||||
iFlowServiceKey := `{
|
||||
"oauth": {
|
||||
"url": "https://demo",
|
||||
"clientid": "demouser",
|
||||
"clientsecret": "******",
|
||||
"tokenurl": "https://demo/oauth/token"
|
||||
}
|
||||
}`
|
||||
config := integrationArtifactTriggerIntegrationTestOptions{
|
||||
IFlowServiceKey: iFlowServiceKey,
|
||||
IntegrationFlowID: "CPI_IFlow_Call_using_Cert",
|
||||
Platform: "cf",
|
||||
MessageBodyPath: filepath.Join(dir, "test.txt"),
|
||||
ContentType: "txt",
|
||||
}
|
||||
|
||||
utils := newIntegrationArtifactTriggerIntegrationTestTestsUtils()
|
||||
utils.AddFile(config.MessageBodyPath, []byte("dummycontent1")) //have to add a file here to see in utils
|
||||
ioutil.WriteFile(config.MessageBodyPath, []byte("dummycontent2"), 0755)
|
||||
httpClient := httpMockCpis{CPIFunction: "TriggerIntegrationTest", ResponseBody: ``, TestType: "Positive"}
|
||||
|
||||
//test
|
||||
err = callIFlowURL(&config, nil, utils, &httpClient, "https://my-service.com/endpoint")
|
||||
|
||||
//assert
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "POST", httpClient.Method)
|
||||
assert.Equal(t, "https://my-service.com/endpoint", httpClient.URL)
|
||||
})
|
||||
|
||||
t.Run("No MessageBodyPath still works (SUCCESS) callIFlowURL", func(t *testing.T) {
|
||||
//init
|
||||
iFlowServiceKey := `{
|
||||
"oauth": {
|
||||
"url": "https://demo",
|
||||
"clientid": "demouser",
|
||||
"clientsecret": "******",
|
||||
"tokenurl": "https://demo/oauth/token"
|
||||
}
|
||||
}`
|
||||
config := integrationArtifactTriggerIntegrationTestOptions{
|
||||
IFlowServiceKey: iFlowServiceKey,
|
||||
IntegrationFlowID: "CPI_IFlow_Call_using_Cert",
|
||||
Platform: "cf",
|
||||
MessageBodyPath: "",
|
||||
ContentType: "txt",
|
||||
}
|
||||
|
||||
utils := newIntegrationArtifactTriggerIntegrationTestTestsUtils()
|
||||
//utils.AddFile(config.MessageBodyPath, []byte("dummycontent1")) //have to add a file here to see in utils
|
||||
//ioutil.WriteFile(config.MessageBodyPath, []byte("dummycontent2"), 0755)
|
||||
httpClient := httpMockCpis{CPIFunction: "TriggerIntegrationTest", ResponseBody: ``, TestType: "Positive"}
|
||||
|
||||
//test
|
||||
err := callIFlowURL(&config, nil, utils, &httpClient, "https://my-service.com/endpoint")
|
||||
|
||||
//assert
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "GET", httpClient.Method)
|
||||
assert.Equal(t, "https://my-service.com/endpoint", httpClient.URL)
|
||||
|
||||
})
|
||||
|
||||
t.Run("nil fileBody (SUCCESS) callIFlowURL", func(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
defer os.RemoveAll(dir) // clean up
|
||||
assert.NoError(t, err, "Error when creating temp dir")
|
||||
//init
|
||||
iFlowServiceKey := `{
|
||||
"oauth": {
|
||||
"url": "https://demo",
|
||||
"clientid": "demouser",
|
||||
"clientsecret": "******",
|
||||
"tokenurl": "https://demo/oauth/token"
|
||||
}
|
||||
}`
|
||||
config := integrationArtifactTriggerIntegrationTestOptions{
|
||||
IFlowServiceKey: iFlowServiceKey,
|
||||
IntegrationFlowID: "CPI_IFlow_Call_using_Cert",
|
||||
Platform: "cf",
|
||||
MessageBodyPath: filepath.Join(dir, "test.txt"),
|
||||
ContentType: "txt",
|
||||
}
|
||||
|
||||
utils := newIntegrationArtifactTriggerIntegrationTestTestsUtils()
|
||||
utils.AddFile(config.MessageBodyPath, []byte(nil)) //have to add a file here to see in utils
|
||||
ioutil.WriteFile(config.MessageBodyPath, []byte(nil), 0755)
|
||||
httpClient := httpMockCpis{CPIFunction: "TriggerIntegrationTest", ResponseBody: ``, TestType: "Positive"}
|
||||
|
||||
//test
|
||||
err = callIFlowURL(&config, nil, utils, &httpClient, "")
|
||||
|
||||
//assert
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
@ -7,80 +7,81 @@ import "github.com/SAP/jenkins-library/pkg/config"
|
||||
// GetStepMetadata return a map with all the step metadata mapped to their stepName
|
||||
func GetAllStepMetadata() map[string]config.StepData {
|
||||
return map[string]config.StepData{
|
||||
"abapAddonAssemblyKitCheckCVs": abapAddonAssemblyKitCheckCVsMetadata(),
|
||||
"abapAddonAssemblyKitCheckPV": abapAddonAssemblyKitCheckPVMetadata(),
|
||||
"abapAddonAssemblyKitCreateTargetVector": abapAddonAssemblyKitCreateTargetVectorMetadata(),
|
||||
"abapAddonAssemblyKitPublishTargetVector": abapAddonAssemblyKitPublishTargetVectorMetadata(),
|
||||
"abapAddonAssemblyKitRegisterPackages": abapAddonAssemblyKitRegisterPackagesMetadata(),
|
||||
"abapAddonAssemblyKitReleasePackages": abapAddonAssemblyKitReleasePackagesMetadata(),
|
||||
"abapAddonAssemblyKitReserveNextPackages": abapAddonAssemblyKitReserveNextPackagesMetadata(),
|
||||
"abapEnvironmentAssembleConfirm": abapEnvironmentAssembleConfirmMetadata(),
|
||||
"abapEnvironmentAssemblePackages": abapEnvironmentAssemblePackagesMetadata(),
|
||||
"abapEnvironmentCheckoutBranch": abapEnvironmentCheckoutBranchMetadata(),
|
||||
"abapEnvironmentCloneGitRepo": abapEnvironmentCloneGitRepoMetadata(),
|
||||
"abapEnvironmentCreateSystem": abapEnvironmentCreateSystemMetadata(),
|
||||
"abapEnvironmentPullGitRepo": abapEnvironmentPullGitRepoMetadata(),
|
||||
"abapEnvironmentRunATCCheck": abapEnvironmentRunATCCheckMetadata(),
|
||||
"batsExecuteTests": batsExecuteTestsMetadata(),
|
||||
"checkChangeInDevelopment": checkChangeInDevelopmentMetadata(),
|
||||
"checkmarxExecuteScan": checkmarxExecuteScanMetadata(),
|
||||
"cloudFoundryCreateService": cloudFoundryCreateServiceMetadata(),
|
||||
"cloudFoundryCreateServiceKey": cloudFoundryCreateServiceKeyMetadata(),
|
||||
"cloudFoundryCreateSpace": cloudFoundryCreateSpaceMetadata(),
|
||||
"cloudFoundryDeleteService": cloudFoundryDeleteServiceMetadata(),
|
||||
"cloudFoundryDeleteSpace": cloudFoundryDeleteSpaceMetadata(),
|
||||
"cloudFoundryDeploy": cloudFoundryDeployMetadata(),
|
||||
"containerExecuteStructureTests": containerExecuteStructureTestsMetadata(),
|
||||
"detectExecuteScan": detectExecuteScanMetadata(),
|
||||
"fortifyExecuteScan": fortifyExecuteScanMetadata(),
|
||||
"gaugeExecuteTests": gaugeExecuteTestsMetadata(),
|
||||
"gctsCloneRepository": gctsCloneRepositoryMetadata(),
|
||||
"gctsCreateRepository": gctsCreateRepositoryMetadata(),
|
||||
"gctsDeploy": gctsDeployMetadata(),
|
||||
"gctsExecuteABAPUnitTests": gctsExecuteABAPUnitTestsMetadata(),
|
||||
"gctsRollback": gctsRollbackMetadata(),
|
||||
"githubCheckBranchProtection": githubCheckBranchProtectionMetadata(),
|
||||
"githubCommentIssue": githubCommentIssueMetadata(),
|
||||
"githubCreateIssue": githubCreateIssueMetadata(),
|
||||
"githubCreatePullRequest": githubCreatePullRequestMetadata(),
|
||||
"githubPublishRelease": githubPublishReleaseMetadata(),
|
||||
"githubSetCommitStatus": githubSetCommitStatusMetadata(),
|
||||
"gitopsUpdateDeployment": gitopsUpdateDeploymentMetadata(),
|
||||
"hadolintExecute": hadolintExecuteMetadata(),
|
||||
"integrationArtifactDeploy": integrationArtifactDeployMetadata(),
|
||||
"integrationArtifactDownload": integrationArtifactDownloadMetadata(),
|
||||
"integrationArtifactGetMplStatus": integrationArtifactGetMplStatusMetadata(),
|
||||
"integrationArtifactGetServiceEndpoint": integrationArtifactGetServiceEndpointMetadata(),
|
||||
"integrationArtifactUpdateConfiguration": integrationArtifactUpdateConfigurationMetadata(),
|
||||
"integrationArtifactUpload": integrationArtifactUploadMetadata(),
|
||||
"jsonApplyPatch": jsonApplyPatchMetadata(),
|
||||
"kanikoExecute": kanikoExecuteMetadata(),
|
||||
"karmaExecuteTests": karmaExecuteTestsMetadata(),
|
||||
"kubernetesDeploy": kubernetesDeployMetadata(),
|
||||
"malwareExecuteScan": malwareExecuteScanMetadata(),
|
||||
"mavenBuild": mavenBuildMetadata(),
|
||||
"mavenExecute": mavenExecuteMetadata(),
|
||||
"mavenExecuteIntegration": mavenExecuteIntegrationMetadata(),
|
||||
"mavenExecuteStaticCodeChecks": mavenExecuteStaticCodeChecksMetadata(),
|
||||
"mtaBuild": mtaBuildMetadata(),
|
||||
"newmanExecute": newmanExecuteMetadata(),
|
||||
"nexusUpload": nexusUploadMetadata(),
|
||||
"npmExecuteLint": npmExecuteLintMetadata(),
|
||||
"npmExecuteScripts": npmExecuteScriptsMetadata(),
|
||||
"pipelineCreateScanSummary": pipelineCreateScanSummaryMetadata(),
|
||||
"protecodeExecuteScan": protecodeExecuteScanMetadata(),
|
||||
"containerSaveImage": containerSaveImageMetadata(),
|
||||
"sonarExecuteScan": sonarExecuteScanMetadata(),
|
||||
"terraformExecute": terraformExecuteMetadata(),
|
||||
"transportRequestDocIDFromGit": transportRequestDocIDFromGitMetadata(),
|
||||
"transportRequestReqIDFromGit": transportRequestReqIDFromGitMetadata(),
|
||||
"transportRequestUploadCTS": transportRequestUploadCTSMetadata(),
|
||||
"transportRequestUploadRFC": transportRequestUploadRFCMetadata(),
|
||||
"transportRequestUploadSOLMAN": transportRequestUploadSOLMANMetadata(),
|
||||
"uiVeri5ExecuteTests": uiVeri5ExecuteTestsMetadata(),
|
||||
"vaultRotateSecretId": vaultRotateSecretIdMetadata(),
|
||||
"artifactPrepareVersion": artifactPrepareVersionMetadata(),
|
||||
"whitesourceExecuteScan": whitesourceExecuteScanMetadata(),
|
||||
"xsDeploy": xsDeployMetadata(),
|
||||
"abapAddonAssemblyKitCheckCVs": abapAddonAssemblyKitCheckCVsMetadata(),
|
||||
"abapAddonAssemblyKitCheckPV": abapAddonAssemblyKitCheckPVMetadata(),
|
||||
"abapAddonAssemblyKitCreateTargetVector": abapAddonAssemblyKitCreateTargetVectorMetadata(),
|
||||
"abapAddonAssemblyKitPublishTargetVector": abapAddonAssemblyKitPublishTargetVectorMetadata(),
|
||||
"abapAddonAssemblyKitRegisterPackages": abapAddonAssemblyKitRegisterPackagesMetadata(),
|
||||
"abapAddonAssemblyKitReleasePackages": abapAddonAssemblyKitReleasePackagesMetadata(),
|
||||
"abapAddonAssemblyKitReserveNextPackages": abapAddonAssemblyKitReserveNextPackagesMetadata(),
|
||||
"abapEnvironmentAssembleConfirm": abapEnvironmentAssembleConfirmMetadata(),
|
||||
"abapEnvironmentAssemblePackages": abapEnvironmentAssemblePackagesMetadata(),
|
||||
"abapEnvironmentCheckoutBranch": abapEnvironmentCheckoutBranchMetadata(),
|
||||
"abapEnvironmentCloneGitRepo": abapEnvironmentCloneGitRepoMetadata(),
|
||||
"abapEnvironmentCreateSystem": abapEnvironmentCreateSystemMetadata(),
|
||||
"abapEnvironmentPullGitRepo": abapEnvironmentPullGitRepoMetadata(),
|
||||
"abapEnvironmentRunATCCheck": abapEnvironmentRunATCCheckMetadata(),
|
||||
"batsExecuteTests": batsExecuteTestsMetadata(),
|
||||
"checkChangeInDevelopment": checkChangeInDevelopmentMetadata(),
|
||||
"checkmarxExecuteScan": checkmarxExecuteScanMetadata(),
|
||||
"cloudFoundryCreateService": cloudFoundryCreateServiceMetadata(),
|
||||
"cloudFoundryCreateServiceKey": cloudFoundryCreateServiceKeyMetadata(),
|
||||
"cloudFoundryCreateSpace": cloudFoundryCreateSpaceMetadata(),
|
||||
"cloudFoundryDeleteService": cloudFoundryDeleteServiceMetadata(),
|
||||
"cloudFoundryDeleteSpace": cloudFoundryDeleteSpaceMetadata(),
|
||||
"cloudFoundryDeploy": cloudFoundryDeployMetadata(),
|
||||
"containerExecuteStructureTests": containerExecuteStructureTestsMetadata(),
|
||||
"detectExecuteScan": detectExecuteScanMetadata(),
|
||||
"fortifyExecuteScan": fortifyExecuteScanMetadata(),
|
||||
"gaugeExecuteTests": gaugeExecuteTestsMetadata(),
|
||||
"gctsCloneRepository": gctsCloneRepositoryMetadata(),
|
||||
"gctsCreateRepository": gctsCreateRepositoryMetadata(),
|
||||
"gctsDeploy": gctsDeployMetadata(),
|
||||
"gctsExecuteABAPUnitTests": gctsExecuteABAPUnitTestsMetadata(),
|
||||
"gctsRollback": gctsRollbackMetadata(),
|
||||
"githubCheckBranchProtection": githubCheckBranchProtectionMetadata(),
|
||||
"githubCommentIssue": githubCommentIssueMetadata(),
|
||||
"githubCreateIssue": githubCreateIssueMetadata(),
|
||||
"githubCreatePullRequest": githubCreatePullRequestMetadata(),
|
||||
"githubPublishRelease": githubPublishReleaseMetadata(),
|
||||
"githubSetCommitStatus": githubSetCommitStatusMetadata(),
|
||||
"gitopsUpdateDeployment": gitopsUpdateDeploymentMetadata(),
|
||||
"hadolintExecute": hadolintExecuteMetadata(),
|
||||
"integrationArtifactDeploy": integrationArtifactDeployMetadata(),
|
||||
"integrationArtifactDownload": integrationArtifactDownloadMetadata(),
|
||||
"integrationArtifactGetMplStatus": integrationArtifactGetMplStatusMetadata(),
|
||||
"integrationArtifactGetServiceEndpoint": integrationArtifactGetServiceEndpointMetadata(),
|
||||
"integrationArtifactTriggerIntegrationTest": integrationArtifactTriggerIntegrationTestMetadata(),
|
||||
"integrationArtifactUpdateConfiguration": integrationArtifactUpdateConfigurationMetadata(),
|
||||
"integrationArtifactUpload": integrationArtifactUploadMetadata(),
|
||||
"jsonApplyPatch": jsonApplyPatchMetadata(),
|
||||
"kanikoExecute": kanikoExecuteMetadata(),
|
||||
"karmaExecuteTests": karmaExecuteTestsMetadata(),
|
||||
"kubernetesDeploy": kubernetesDeployMetadata(),
|
||||
"malwareExecuteScan": malwareExecuteScanMetadata(),
|
||||
"mavenBuild": mavenBuildMetadata(),
|
||||
"mavenExecute": mavenExecuteMetadata(),
|
||||
"mavenExecuteIntegration": mavenExecuteIntegrationMetadata(),
|
||||
"mavenExecuteStaticCodeChecks": mavenExecuteStaticCodeChecksMetadata(),
|
||||
"mtaBuild": mtaBuildMetadata(),
|
||||
"newmanExecute": newmanExecuteMetadata(),
|
||||
"nexusUpload": nexusUploadMetadata(),
|
||||
"npmExecuteLint": npmExecuteLintMetadata(),
|
||||
"npmExecuteScripts": npmExecuteScriptsMetadata(),
|
||||
"pipelineCreateScanSummary": pipelineCreateScanSummaryMetadata(),
|
||||
"protecodeExecuteScan": protecodeExecuteScanMetadata(),
|
||||
"containerSaveImage": containerSaveImageMetadata(),
|
||||
"sonarExecuteScan": sonarExecuteScanMetadata(),
|
||||
"terraformExecute": terraformExecuteMetadata(),
|
||||
"transportRequestDocIDFromGit": transportRequestDocIDFromGitMetadata(),
|
||||
"transportRequestReqIDFromGit": transportRequestReqIDFromGitMetadata(),
|
||||
"transportRequestUploadCTS": transportRequestUploadCTSMetadata(),
|
||||
"transportRequestUploadRFC": transportRequestUploadRFCMetadata(),
|
||||
"transportRequestUploadSOLMAN": transportRequestUploadSOLMANMetadata(),
|
||||
"uiVeri5ExecuteTests": uiVeri5ExecuteTestsMetadata(),
|
||||
"vaultRotateSecretId": vaultRotateSecretIdMetadata(),
|
||||
"artifactPrepareVersion": artifactPrepareVersionMetadata(),
|
||||
"whitesourceExecuteScan": whitesourceExecuteScanMetadata(),
|
||||
"xsDeploy": xsDeployMetadata(),
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +146,7 @@ func Execute() {
|
||||
rootCmd.AddCommand(IntegrationArtifactDownloadCommand())
|
||||
rootCmd.AddCommand(AbapEnvironmentAssembleConfirmCommand())
|
||||
rootCmd.AddCommand(IntegrationArtifactUploadCommand())
|
||||
rootCmd.AddCommand(IntegrationArtifactTriggerIntegrationTestCommand())
|
||||
rootCmd.AddCommand(TerraformExecuteCommand())
|
||||
rootCmd.AddCommand(ContainerExecuteStructureTestsCommand())
|
||||
rootCmd.AddCommand(GaugeExecuteTestsCommand())
|
||||
|
@ -0,0 +1,30 @@
|
||||
# ${docGenStepName}
|
||||
|
||||
## ${docGenDescription}
|
||||
|
||||
## ${docGenParameters}
|
||||
|
||||
## ${docGenConfiguration}
|
||||
|
||||
## ${docJenkinsPluginDependencies}
|
||||
|
||||
## Example
|
||||
|
||||
Example configuration for the use in a `Jenkinsfile`.
|
||||
|
||||
```groovy
|
||||
integrationArtifactTriggerIntegrationTest script: this
|
||||
```
|
||||
|
||||
Example for the use in a YAML configuration file (such as `.pipeline/config.yaml`).
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
<...>
|
||||
integrationArtifactTriggerIntegrationTest:
|
||||
iFlowCredentialsId: 'MY_IFLOW_SERVICE_KEY'
|
||||
integrationFlowId: 'INTEGRATION_FLOW_ID'
|
||||
contentType: 'text/plain'
|
||||
messageBodyPath: 'myIntegrationsTest/testBody'
|
||||
platform: cf
|
||||
```
|
@ -48,6 +48,8 @@ func GetCPIFunctionMockResponse(functionName, testType string) (*http.Response,
|
||||
return GetIntegrationArtifactDeployStatusMockResponse(testType)
|
||||
case "GetIntegrationArtifactDeployErrorDetails":
|
||||
return GetIntegrationArtifactDeployErrorDetailsMockResponse(testType)
|
||||
case "TriggerIntegrationTest":
|
||||
return TriggerIntegrationTestMockResponse(testType)
|
||||
default:
|
||||
res := http.Response{
|
||||
StatusCode: 404,
|
||||
@ -161,6 +163,26 @@ func GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testCaseType st
|
||||
return &res, errors.New("Unable to get integration flow service endpoint, Response Status code:400")
|
||||
}
|
||||
|
||||
//TriggerIntegrationTestMockResponse
|
||||
func TriggerIntegrationTestMockResponse(testCaseType string) (*http.Response, error) {
|
||||
if testCaseType == "Positive" {
|
||||
return &http.Response{
|
||||
StatusCode: 200,
|
||||
}, nil
|
||||
}
|
||||
res := http.Response{
|
||||
StatusCode: 400,
|
||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(`{
|
||||
"code": "Bad Request",
|
||||
"message": {
|
||||
"@lang": "en",
|
||||
"#text": "invalid"
|
||||
}
|
||||
}`))),
|
||||
}
|
||||
return &res, errors.New("Unable to trigger integration test, Response Status code:400")
|
||||
}
|
||||
|
||||
//GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody -Provide http respose body for positive case
|
||||
func GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody() (*http.Response, error) {
|
||||
|
||||
|
@ -0,0 +1,70 @@
|
||||
metadata:
|
||||
name: integrationArtifactTriggerIntegrationTest
|
||||
description: Test the service endpoint of your iFlow
|
||||
longDescription: |
|
||||
With this step you can test your intergration flow exposed by SAP Cloud Platform Integration on a tenant using OData API.Learn more about the SAP Cloud Integration remote API for getting service endpoint of deployed integration artifact [here](https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/d1679a80543f46509a7329243b595bdb.html).
|
||||
|
||||
spec:
|
||||
inputs:
|
||||
secrets:
|
||||
- name: iFlowCredentialsId
|
||||
description: Jenkins credentials ID containing username and password for authentication to the SAP Cloud Platform Integration API's
|
||||
type: jenkins
|
||||
params:
|
||||
- name: iFlowServiceKey
|
||||
type: string
|
||||
description: User to authenticate to the SAP Cloud Platform Integration Service
|
||||
scope:
|
||||
- PARAMETERS
|
||||
mandatory: true
|
||||
secret: true
|
||||
resourceRef:
|
||||
- name: iFlowCredentialsId
|
||||
type: secret
|
||||
param: iFlowServiceKey
|
||||
- name: integrationFlowId
|
||||
type: string
|
||||
description: Specifies the ID of the Integration Flow artifact
|
||||
scope:
|
||||
- PARAMETERS
|
||||
- STAGES
|
||||
- STEPS
|
||||
- GENERAL
|
||||
mandatory: true
|
||||
- name: platform
|
||||
type: string
|
||||
description: Specifies the running platform of the SAP Cloud platform integraion service
|
||||
scope:
|
||||
- PARAMETERS
|
||||
- STAGES
|
||||
- STEPS
|
||||
mandatory: false
|
||||
default: cf
|
||||
possibleValues:
|
||||
- cf
|
||||
- neo
|
||||
- name: iFlowServiceEndpointUrl
|
||||
resourceRef:
|
||||
- name: commonPipelineEnvironment
|
||||
param: custom/iFlowServiceEndpoint
|
||||
type: string
|
||||
description: Specifies the URL endpoint of the iFlow. Please provide in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.
|
||||
scope:
|
||||
- PARAMETERS
|
||||
mandatory: true
|
||||
- name: contentType
|
||||
type: string
|
||||
description: Specifies the content type of the file defined in messageBodyPath e.g. application/json
|
||||
scope:
|
||||
- PARAMETERS
|
||||
- STAGES
|
||||
- STEPS
|
||||
mandatory: false
|
||||
- name: messageBodyPath
|
||||
type: string
|
||||
description: Speficfies the relative file path to the message body.
|
||||
scope:
|
||||
- PARAMETERS
|
||||
- STAGES
|
||||
- STEPS
|
||||
mandatory: false
|
@ -184,6 +184,7 @@ public class CommonStepsTest extends BasePiperTest{
|
||||
'integrationArtifactGetServiceEndpoint', //implementing new golang pattern without fields
|
||||
'integrationArtifactDownload', //implementing new golang pattern without fields
|
||||
'integrationArtifactUpload', //implementing new golang pattern without fields
|
||||
'integrationArtifactTriggerIntegrationTest', //implementing new golang pattern without fields
|
||||
'containerExecuteStructureTests', //implementing new golang pattern without fields
|
||||
'transportRequestUploadSOLMAN', //implementing new golang pattern without fields
|
||||
'transportRequestReqIDFromGit', //implementing new golang pattern without fields
|
||||
|
11
vars/integrationArtifactTriggerIntegrationTest.groovy
Normal file
11
vars/integrationArtifactTriggerIntegrationTest.groovy
Normal file
@ -0,0 +1,11 @@
|
||||
import groovy.transform.Field
|
||||
|
||||
@Field String STEP_NAME = getClass().getName()
|
||||
@Field String METADATA_FILE = 'metadata/integrationArtifactTriggerIntegrationTest.yaml'
|
||||
|
||||
void call(Map parameters = [:]) {
|
||||
List credentials = [
|
||||
[type: 'token', id: 'iFlowCredentialsId', env: ['PIPER_iFlowServiceKey']]
|
||||
]
|
||||
piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, credentials)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user