@platforma-sdk/workflow-tengo 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tengo/lib/exec.internal.lib.tengo +2 -2
- package/dist/tengo/lib/exec.lib.tengo +3 -0
- package/dist/tengo/lib/test.lib.tengo +204 -0
- package/dist/tengo/lib/tpl.lib.tengo +0 -1
- package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
- package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
- package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.aggregate.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.map-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
- package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
- package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
- package/package.json +1 -1
|
@@ -123,7 +123,7 @@ _binPackageCallOptions := func(runOptions, variables, descriptor, softPackage) {
|
|
|
123
123
|
envs := ll.toStrict({})
|
|
124
124
|
args := []
|
|
125
125
|
|
|
126
|
-
// Real command
|
|
126
|
+
// Real command should be:
|
|
127
127
|
// [<runEnv bin>] [<runEnv options>] [<entrypoint bin>] [<entrypoint options>] <cmd> <args>
|
|
128
128
|
if (maps.containsKey(descriptor, "runEnv")) {
|
|
129
129
|
runEnvInfo := _loadRunEnvironment(descriptor, runOptions.software.name, softPackage)
|
|
@@ -198,7 +198,7 @@ _remotePackageCallOptions := func(runOptions) {
|
|
|
198
198
|
binaryRunOptions := func(runOptions) {
|
|
199
199
|
if (is_undefined(ll.fromStrict(runOptions).software)) {
|
|
200
200
|
//
|
|
201
|
-
// Simple local command run, no software
|
|
201
|
+
// Simple local command run, no software packages involved (backward compatibility)
|
|
202
202
|
//
|
|
203
203
|
return _directCallOptions(runOptions)
|
|
204
204
|
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Library for tengo unit tests.
|
|
3
|
+
* Contains collection of helpers, that make tengo unit tests more compact, easier for reading and writing.
|
|
4
|
+
*
|
|
5
|
+
* WARNING: It is designed to be imported ONLY in *.test.tengo files.
|
|
6
|
+
* As it works ONLY in tengo unit tests context, it will break any workflow if imported
|
|
7
|
+
* in .lib.tengo or .tpl.tengo file.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
test := import("test")
|
|
11
|
+
|
|
12
|
+
//
|
|
13
|
+
// Basic re-export from "test" builtin library with some conveniences
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Skip the test writing given message to the console log.
|
|
18
|
+
*
|
|
19
|
+
* @param args: []any - message to be written.
|
|
20
|
+
* Each argument is converted to string with its default formatter.
|
|
21
|
+
*/
|
|
22
|
+
skip := func(...args) {
|
|
23
|
+
test.skip(args...)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Formatted version of skip(). skipf(msg, ...args) == skip(format(msg, args...))
|
|
28
|
+
*
|
|
29
|
+
* @param msg: string - message with formatting directives.
|
|
30
|
+
* @param args: []any - arguments for directives in <msg>.
|
|
31
|
+
*/
|
|
32
|
+
skipf := func(msg, ...args) {
|
|
33
|
+
skip(format(msg, args...))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Fail the test in place. Interrupts execution of single test and prints a
|
|
38
|
+
* failure message to the console log.
|
|
39
|
+
*
|
|
40
|
+
* @param args: []any - message to be written.
|
|
41
|
+
* Each argument is converted to string with its default formatter.
|
|
42
|
+
*/
|
|
43
|
+
fail := func(...args) {
|
|
44
|
+
test.fail(args...)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Formatted version of fail(). failf(msg, ...args) == fail(format(msg, args...))
|
|
49
|
+
*
|
|
50
|
+
* @param msg: string - message with formatting directives.
|
|
51
|
+
* @param args: []any - arguments for directives in <msg>.
|
|
52
|
+
*/
|
|
53
|
+
failf := func(msg, ...args) {
|
|
54
|
+
fail(format(msg, args...))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Write message to console log.
|
|
59
|
+
*
|
|
60
|
+
* @param args: []any - message to be written.
|
|
61
|
+
* Each argument is converted to string with its default formatter.
|
|
62
|
+
*/
|
|
63
|
+
log := func(...args) {
|
|
64
|
+
test.log(args...)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Formatted version of log(). logf(msg, ...args) == log(format(msg, args...))
|
|
69
|
+
*
|
|
70
|
+
* @param msg: string - message with formatting directives.
|
|
71
|
+
* @param args: []any - arguments for directives in <msg>.
|
|
72
|
+
*/
|
|
73
|
+
logf := func(msg, ...args) {
|
|
74
|
+
test.log(format(msg, args...))
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Mark test as executed for tengo testing engine.
|
|
79
|
+
*
|
|
80
|
+
* Regular tengo file with tests contains bunch of fuctions starting with 'Test' prefix, like `TestMyFunction := func() { ... }`.
|
|
81
|
+
* You DO NOT need to call this Done() method if you have file with Test* functions.
|
|
82
|
+
*
|
|
83
|
+
* For some rare cases, you may want to define your own custom testing script, that will call functions on its own instead
|
|
84
|
+
* of using the standard test functions naming. In this case, testing engine needs to know the difference between "nothing was called at all"
|
|
85
|
+
* and "everything was done well". This is what this method for.
|
|
86
|
+
*
|
|
87
|
+
* You don't need it in 99.9% of cases.
|
|
88
|
+
*
|
|
89
|
+
* This method does not interrupt test execution and is intended for use in custom test scripts
|
|
90
|
+
* without declared test functions.
|
|
91
|
+
*/
|
|
92
|
+
done := func() {
|
|
93
|
+
test.done()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//
|
|
97
|
+
// Boolean assertions
|
|
98
|
+
//
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Require <condition> to be true, failing test when not.
|
|
102
|
+
*
|
|
103
|
+
* @param condition: bool
|
|
104
|
+
* @param msg: []any - message to be printed on check failure
|
|
105
|
+
*/
|
|
106
|
+
isTrue := func(condition, ...msg) {
|
|
107
|
+
if !condition {
|
|
108
|
+
test.fail("<condition> != 'true': ", msg...)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Formatted version of isTrue(). isTruef(condition, msg, ...args) == isTrue(condition, format(msg, args...))
|
|
114
|
+
*
|
|
115
|
+
* @param condition: bool
|
|
116
|
+
* @param msg: string - message with formatting directives to be printed on check failure
|
|
117
|
+
* @param args: []any - arguments for formatting directives in <msg>
|
|
118
|
+
*/
|
|
119
|
+
isTruef := func(condition, msg, ...args) {
|
|
120
|
+
isTrue(condition, format(msg, args...))
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Require <condition> to be false, failing test when not.
|
|
125
|
+
*
|
|
126
|
+
* @param condition: bool
|
|
127
|
+
* @param args: []any - message to be printed on check failure
|
|
128
|
+
*/
|
|
129
|
+
isFalse := func(condition, ...args) {
|
|
130
|
+
if condition {
|
|
131
|
+
test.fail("<condition> != 'false'", args...)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Formatted version of isFalse(). isFalsef(condition, msg, ..args) == isFalse(condition, format(msg, args...))
|
|
137
|
+
*
|
|
138
|
+
* @param condition: bool
|
|
139
|
+
* @param msg: string - message with formatting directives to be printed on check failure
|
|
140
|
+
* @param args: []any - arguments for formatting directives in <msg>
|
|
141
|
+
*/
|
|
142
|
+
isFalsef := func(condition, msg, ...args) {
|
|
143
|
+
isFalse(condition, format(msg, args...))
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//
|
|
147
|
+
// Equality assertions
|
|
148
|
+
//
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Fails test when <expect> != <value>
|
|
152
|
+
*
|
|
153
|
+
* @param expect: any - expected value for the equality check
|
|
154
|
+
* @param value: any - the value to be checked
|
|
155
|
+
* @param args: []any - the message to be printed on check failure
|
|
156
|
+
*/
|
|
157
|
+
isEqual := func(expect, value, ...args) {
|
|
158
|
+
if expect == value {
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
msg := format("%q != %q (expect: %#v, got %#v)", expect, value, expect, value)
|
|
163
|
+
|
|
164
|
+
fail(msg, args...)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Formatted version of isEqual(). isEqualf(expect, value, msg, ..args) == isEqual(expect, value, format(msg, args...))
|
|
169
|
+
*
|
|
170
|
+
* @param expect: any - expected value for the equality check
|
|
171
|
+
* @param value: any - the value to be checked
|
|
172
|
+
* @param msg: string - message with formatting directives to be printed on check failure
|
|
173
|
+
* @param args: []any - arguments for formatting directives in <msg>
|
|
174
|
+
*/
|
|
175
|
+
isEqualf := func(expect, value, msg, ...args) {
|
|
176
|
+
isEqual(expect, value, format(msg, args...))
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export {
|
|
180
|
+
//
|
|
181
|
+
// Builtin 'test' module method wrappers
|
|
182
|
+
//
|
|
183
|
+
done : done,
|
|
184
|
+
skip : skip,
|
|
185
|
+
skipf : skipf,
|
|
186
|
+
fail : fail,
|
|
187
|
+
failf : failf,
|
|
188
|
+
log : log,
|
|
189
|
+
logf : logf,
|
|
190
|
+
|
|
191
|
+
//
|
|
192
|
+
// Boolean assertions
|
|
193
|
+
//
|
|
194
|
+
isTrue : isTrue,
|
|
195
|
+
isTruef : isTruef,
|
|
196
|
+
isFalse : isFalse,
|
|
197
|
+
isFalsef : isFalsef,
|
|
198
|
+
|
|
199
|
+
//
|
|
200
|
+
// Equality assertions
|
|
201
|
+
//
|
|
202
|
+
isEqual : isEqual,
|
|
203
|
+
isEqualf : isEqualf
|
|
204
|
+
}
|
|
@@ -292,7 +292,6 @@ tpl := func() {
|
|
|
292
292
|
ll.assert(is_map(r), "expected map, got ", r)
|
|
293
293
|
|
|
294
294
|
for name, ref in r {
|
|
295
|
-
ll.assert(smart.isReference(ref), "expected reference, got %v", ref)
|
|
296
295
|
ll.assert(is_undefined(newInputs[name]), "prepare name is already in use: %s", name)
|
|
297
296
|
|
|
298
297
|
builder.add(name, ref)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|