-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
52 lines (42 loc) · 1.48 KB
/
Copy pathmain.go
File metadata and controls
52 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"log"
"os"
"path/filepath"
"github.com/jeffail/tunny"
"github.com/thetonymaster/test_framework/configuration"
"github.com/thetonymaster/test_framework/provider/container"
"github.com/thetonymaster/test_framework/provider/test"
)
func main() {
args := os.Args[1:]
conf, err := configuration.Read(args[0])
if err != nil {
log.Fatal(err)
}
pool, _ := tunny.CreatePool(conf.Containers.Limit, func(f interface{}) interface{} {
input, _ := f.(func())
input()
return nil
}).Open()
defer pool.Close()
for framework, configuration := range conf.Tests {
runTests(framework, &configuration, conf, pool)
}
// dir, _ := filepath.Abs(filepath.Dir(conf.Tests["junit"].Path))
// containerProvider := container.NewDockerComposeGenerator([]string{conf.Tests["junit"].Path})
// jUnitTestProvider := test.NewJUnit(containerProvider, conf.Tests["junit"].Target, pool)
// tasks := jUnitTestProvider.GetFiles(dir + "/src/test/")
// jUnitTestProvider.RunTask(tasks)
}
func runTests(framework string, cfb *configuration.TestConfiguration,
conf *configuration.Configuration, pool *tunny.WorkPool) {
switch framework {
case "junit":
dir, _ := filepath.Abs(filepath.Dir(conf.Tests["junit"].Path))
containerProvider := container.NewDockerComposeGenerator([]string{conf.Tests["junit"].Path})
jUnitTestProvider := test.NewJUnit(containerProvider, conf.Tests["junit"].Target, pool)
tasks := jUnitTestProvider.GetFiles(dir + "/src/test/")
jUnitTestProvider.RunTask(tasks)
}
}