@@ -6,27 +6,8 @@ import (
66 "unicode"
77)
88
9- // getModule returns the name of the module a given test result artifact was produced by
10- // based of the artifacts path.
11- // path example: <PATH_TO_YOUR_PROJECT>/<MODULE_NAME>/build/test-results/testDemoDebugUnitTest/TEST-example.com.helloworld.ExampleUnitTest.xml
12- func getModule (path string ) (string , error ) {
13- parts := strings .Split (path , "/" )
14- i := len (parts ) - 1
15- for i > 0 && parts [i ] != "test-results" {
16- i --
17- }
18-
19- if i == 0 {
20- return "" , fmt .Errorf ("path (%s) does not contain 'test-results' folder" , path )
21- }
22-
23- return parts [i - 2 ], nil
24- }
25-
26- // getVariant returns the name of the build variant a given test result artifact was produced by
27- // based of the artifacts path.
28- // path example: <PATH_TO_YOUR_PROJECT>/<MODULE_NAME>/build/test-results/testDemoDebugUnitTest/TEST-example.com.helloworld.ExampleUnitTest.xml
29- func getVariant (path string ) (string , error ) {
9+ // getUniqueDir returns the unique subdirectory inside the test addon export diroctory for a given artifact.
10+ func getUniqueDir (path string ) (string , error ) {
3011 parts := strings .Split (path , "/" )
3112 i := len (parts ) - 1
3213 for i > 0 && parts [i ] != "test-results" {
@@ -43,20 +24,9 @@ func getVariant(path string) (string, error) {
4324
4425 runes := []rune (variant )
4526 runes [0 ] = unicode .ToLower (runes [0 ])
46- return string (runes ), nil
47- }
27+ variant = string (runes )
4828
49- // getUniqueDir returns the unique subdirectory inside the test addon export diroctory for a given artifact.
50- func getUniqueDir (path string ) (string , error ) {
51- module , err := getModule (path )
52- if err != nil {
53- return "" , fmt .Errorf ("get module from path (%s): %s" , path , err )
54- }
55-
56- variant , err := getVariant (path )
57- if err != nil {
58- return "" , fmt .Errorf ("get variant from path (%s): %s" , path , err )
59- }
29+ module := parts [i - 2 ]
6030
6131 return module + "-" + variant , nil
6232}
0 commit comments