forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently we support two binaries: 1. openshift-tests one, which is the current way how to run tests 2. k8s-tests, which allows running k8s native tests All the variables required to run tests are injected through environment variables.
- Loading branch information
Showing
5 changed files
with
121 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package ginkgo | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"encoding/json" | ||
"io" | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
"strings" | ||
"time" | ||
|
||
"github.com/openshift/origin/test/extended/util/annotate/generated" | ||
) | ||
|
||
type serializedTest struct { | ||
Name string | ||
} | ||
|
||
func externalTestsForSuite(ctx context.Context) ([]*testCase, error) { | ||
var tests []*testCase | ||
|
||
// TODO: make the binary name configurable | ||
testBinary := filepath.Dir(os.Args[0]) + "/k8s-tests" | ||
command := exec.Command(testBinary, "list") | ||
|
||
testList, err := runWithTimeout(ctx, command, 1*time.Minute) | ||
if err != nil { | ||
return nil, err | ||
} | ||
buf := bytes.NewBuffer(testList) | ||
for { | ||
line, err := buf.ReadString('\n') | ||
if err == io.EOF { | ||
break | ||
} | ||
if !strings.HasPrefix(line, "[{") { | ||
continue | ||
} | ||
serializedTests := []serializedTest{} | ||
err = json.Unmarshal([]byte(line), &serializedTests) | ||
if err != nil { | ||
return nil, err | ||
} | ||
for _, test := range serializedTests { | ||
if append, ok := generated.Annotations[test.Name]; ok { | ||
test.Name += append | ||
} | ||
tests = append(tests, &testCase{ | ||
name: test.Name, | ||
binaryName: testBinary, | ||
}) | ||
} | ||
} | ||
return tests, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters