summaryrefslogtreecommitdiff
path: root/test/script/artifact.et
blob: d353b49870c7a80dbffe3ee0f3fc85884f4c91f0 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
module artifact

asset scripts:
    path: ../asset/artifact


test ExtractArtifact:
    node n
    local:
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "run", "generate" ]
        expect /job-finish generate done/ from p

    local:
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.first", "extracted" ]
    local:
        shell on n as s:
            cat ./extracted
        expect /content 1/ from s

    local:
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.second", "generate.third", "." ]
    local:
        shell on n as s:
            cat ./f2
            cat ./f3
        expect /content 2/ from s
        expect /content 3/ from s

    local:
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.dir", "." ]
    local:
        shell on n as s:
            cat ./dir/f2
            cat ./dir/fa
            cat ./dir/subdir/fb
        expect /content 2/ from s
        expect /content a/ from s
        expect /content b/ from s

    local:
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.sdir", "extracted_subdir" ]
    local:
        shell on n as s:
            cat ./extracted_subdir/fb
        expect /content b/ from s


test ExtractArtifactForce:
    node n
    local:
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "run", "generate" ]
        expect /job-finish generate done/ from p

    # TODO: test failure without --force
    #local:
    #    shell on n:
    #        touch extracted
    #    spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.first", "extracted" ]
    #local:

    local:
        shell on n:
            touch extracted
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "--force", "generate.first", "extracted" ]
    local:
        shell on n as s:
            cat ./extracted
        expect /content 1/ from s

    # TODO: test failure without --force
    #local:
    #    shell on n:
    #        touch f1
    #    spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.first", "." ]
    #local:

    local:
        shell on n:
            touch f1
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "--force", "generate.first", "." ]
    local:
        shell on n as s:
            cat ./f1
        expect /content 1/ from s

    # TODO: test failure without --force
    #local:
    #    shell on n:
    #        mkdir dir
    #        touch dir/existing_file
    #    spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.dir", "." ]
    #local:

    local:
        shell on n:
            mkdir dir
            touch dir/existing_file
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "--force", "generate.dir", "." ]
    local:
        shell on n as s:
            ls dir
            echo DONE
        expect /f2/ from s
        expect /fa/ from s
        expect /subdir/ from s
        expect /(.*)/ from s capture done
        guard (done == "DONE")

    # TODO: test failure without --force
    #local:
    #    shell on n:
    #        touch dir
    #    spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "generate.dir", "." ]
    #local:

    local:
        shell on n:
            touch dir
        spawn on n as p args [ "--storage=.minici", "${scripts.path}/minici.yaml", "extract", "--force", "generate.dir", "." ]
    local:
        shell on n as s:
            ls dir
            echo DONE
        expect /f2/ from s
        expect /fa/ from s
        expect /subdir/ from s
        expect /(.*)/ from s capture done
        guard (done == "DONE")