mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
f5c33d51bb
* Change parameter type of nodeExtDescriptorMapping (cherry picked from commitca7ce0485a
) * Remove usage of the depricated ioutil package (cherry picked from commit9821915b33
) * Fix cmd failure if neither git/commitId nor customDescription are provided (cherry picked from commitc362681e45
) * Fix unit test (cherry picked from commit53a90aabb5
) * Step metadata, step code generation * change type of nodeExtDescriptorMapping for export * Refactoring and export implementation * integration test * Add export step * Integration test * format * discard piper.go * Review related changes * restore piper.go * remove unused method * Extend documentation * Add parameter useGoStep to tmsUpload.groovy * Regenerate steps * Rename function * refactor constants * Add error path tests * Move some code to tms package * Move more code to tms * Combine tmsUpload, tmsUtils * Add groovy wrapper * add parameters to groovy step * add import * jenkinsUtils instance * comment namedUser logic in groovy * namedUser param * remove logic for namedUser param * Remove TMS integration tests * discard changes in tmsUpload.groovy * Remove parameters * Restore parameters * Change type of NodeExtDescriptorMapping to map[string]interface{} * tmsUpload: Change type of NodeExtDescriptorMapping to map * Resolve ioutil deprecation * Review related changes * Formatting * Review related improvements * Add tmsUtils test * Formatting tmsUtils_test * Remove parameters from groovy wrapper * Remove tmsUtils_test * Add TMS steps to fieldRelatedWhitelist * Add integration test * Add test to github_actions_integration_test_list.yml * Move test helper method * Step documentation placeholder * Remove parameter StashContent * Restore cmd/integrationArtifactTransport.go --------- Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>
57 lines
1.9 KiB
Go
57 lines
1.9 KiB
Go
//go:build integration
|
|
// +build integration
|
|
|
|
// can be executed with
|
|
// go test -v -tags integration -run TestTmsExportIntegration ./integration/...
|
|
|
|
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTmsExportIntegrationYaml(t *testing.T) {
|
|
// success case: run with custom config
|
|
readEnv()
|
|
container := givenThisContainer(t, IntegrationTestDockerExecRunnerBundle{
|
|
Image: "devxci/mbtci-java11-node14",
|
|
User: "root",
|
|
TestDir: []string{"testdata", "TestTmsIntegration"},
|
|
Environment: map[string]string{"PIPER_tmsServiceKey": tmsServiceKey},
|
|
})
|
|
defer container.terminate(t)
|
|
|
|
err := container.whenRunningPiperCommand("tmsExport", "--customConfig=.pipeline/export_config.yml")
|
|
if err != nil {
|
|
t.Fatalf("Piper command failed %s", err)
|
|
}
|
|
|
|
container.assertHasOutput(t, "tmsExport - File uploaded successfully")
|
|
container.assertHasOutput(t, "tmsExport - MTA extension descriptor updated successfully")
|
|
container.assertHasOutput(t, "tmsExport - Node export executed successfully")
|
|
container.assertHasOutput(t, "tmsExport - SUCCESS")
|
|
}
|
|
|
|
func TestTmsExportIntegrationBinFailDescription(t *testing.T) {
|
|
// error case: run cmd with invalid description
|
|
readEnv()
|
|
container := givenThisContainer(t, IntegrationTestDockerExecRunnerBundle{
|
|
Image: "devxci/mbtci-java11-node14",
|
|
User: "root",
|
|
TestDir: []string{"testdata", "TestTmsIntegration"},
|
|
Environment: map[string]string{"PIPER_tmsServiceKey": tmsServiceKey},
|
|
})
|
|
defer container.terminate(t)
|
|
|
|
err := container.whenRunningPiperCommand("tmsExport",
|
|
"--mtaPath=scv_x.mtar",
|
|
"--nodeName=PIPER-TEST",
|
|
"--customDescription={Bad description}")
|
|
|
|
assert.Error(t, err, "Did expect error")
|
|
container.assertHasOutput(t, "error tmsExport - HTTP request failed with error")
|
|
container.assertHasOutput(t, "Failed to run tmsExport - failed to export file to node")
|
|
}
|