summaryrefslogtreecommitdiff
path: root/test/script/run.et
blob: 4f4e016e9f7e9bc5c6c0350274847d7041f5103f (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
module run

asset scripts:
    path: ../asset/run

def expect_result from p of job result result:
    let dummy = job == ""
    expect from p:
        /job-start $job/
        /job-finish $job ([a-z]+)/ capture done
    guard (done == result)


test RunWithouRepo:
    node n
    spawn on n as p args [ "${scripts.path}/norepo-basic.yaml", "run", "success", "failure" ]
    expect_result from p:
        of "success" result "done"
        of "failure" result "failed"
    expect /(.*)/ from p capture done
    guard (done == "run-finish")


test RunWithRepo:
    node n
    shell on n as git_init:
        git -c init.defaultBranch=master init -q
        git -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit'
        git rev-parse HEAD
        cp "${scripts.path}/repo-basic.yaml" minici.yaml
        git add minici.yaml
        git -c user.name=test -c user.email=test commit -q -m 'basic1'
        git rev-parse HEAD^{tree}
        cp "${scripts.path}/repo-basic2.yaml" minici.yaml
        git add minici.yaml
        git -c user.name=test -c user.email=test commit -q -m 'basic1'
        git rev-parse HEAD
        git rev-parse HEAD^{tree}

    expect /([0-9a-f]+)/ from git_init capture c0
    expect /([0-9a-f]+)/ from git_init capture t1
    expect /([0-9a-f]+)/ from git_init capture c2
    expect /([0-9a-f]+)/ from git_init capture t2

    local:
        spawn on n as p args [ "run", "--range=$c0..$c2" ]
        expect_result from p:
            of "$t1.success" result "done"
            of "$t1.failure" result "failed"

            of "$t2.success" result "done"
            of "$t2.failure" result "failed"
            of "$t2.third" result "done"
            of "$t2.fourth" result "done"

        expect /(.*)/ from p capture done
        guard (done == "run-finish")

    local:
        spawn on n as p args [ "./minici.yaml", "run", "--range=$c0..$c2" ]
        expect_result from p:
            of "$t1.success" result "done"
            of "$t1.failure" result "failed"
            of "$t1.third" result "done"
            of "$t1.fourth" result "done"

            of "$t2.success" result "done"
            of "$t2.failure" result "failed"
            of "$t2.third" result "done"
            of "$t2.fourth" result "done"

        expect /(.*)/ from p capture done
        guard (done == "run-finish")