@cubejs-backend/testing 0.28.32 → 0.28.37
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/CHANGELOG.md +35 -0
- package/birdbox-fixtures/postgresql/schema/PreAggregationTest.js +379 -0
- package/birdbox-fixtures/postgresql/scripts/load-pre-aggregations.sh +3 -0
- package/birdbox-fixtures/postgresql/scripts/pre-aggregations.sql +30 -0
- package/birdbox-fixtures/postgresql-cubestore.yml +1 -1
- package/dist/src/birdbox.d.ts +3 -0
- package/dist/src/birdbox.d.ts.map +1 -1
- package/dist/src/birdbox.js +13 -10
- package/dist/src/birdbox.js.map +1 -1
- package/package.json +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.28.37](https://github.com/cube-js/cube.js/compare/v0.28.36...v0.28.37) (2021-09-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @cubejs-backend/testing
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.28.35](https://github.com/cube-js/cube.js/compare/v0.28.34...v0.28.35) (2021-09-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @cubejs-backend/testing
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.28.34](https://github.com/cube-js/cube.js/compare/v0.28.33...v0.28.34) (2021-09-13)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @cubejs-backend/testing
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [0.28.33](https://github.com/cube-js/cube.js/compare/v0.28.32...v0.28.33) (2021-09-11)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* `updateWindow` validation isn't consistent with `refreshKey` interval parsing -- allow `s` at the end of time interval ([#3403](https://github.com/cube-js/cube.js/issues/3403)) ([57559e7](https://github.com/cube-js/cube.js/commit/57559e7841657e1900a30522ce5a178d091b6474))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [0.28.32](https://github.com/cube-js/cube.js/compare/v0.28.31...v0.28.32) (2021-09-06)
|
|
7
42
|
|
|
8
43
|
**Note:** Version bump only for package @cubejs-backend/testing
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
cube(`visitors`, {
|
|
2
|
+
sql: `
|
|
3
|
+
select * from visitors WHERE ${FILTER_PARAMS.visitors.createdAt.filter('created_at')}
|
|
4
|
+
AND ${FILTER_PARAMS.ReferenceOriginalSql.createdAt.filter('created_at')}
|
|
5
|
+
`,
|
|
6
|
+
|
|
7
|
+
joins: {
|
|
8
|
+
visitor_checkins: {
|
|
9
|
+
relationship: 'hasMany',
|
|
10
|
+
sql: `${CUBE.id} = ${visitor_checkins.visitor_id}`
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
cards: {
|
|
14
|
+
relationship: 'hasMany',
|
|
15
|
+
sql: `${visitors.id} = ${cards.visitorId}`
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
measures: {
|
|
20
|
+
count: {
|
|
21
|
+
type: 'count'
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
checkinsTotal: {
|
|
25
|
+
sql: `${checkinsCount}`,
|
|
26
|
+
type: 'sum'
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
checkinsRollingTotal: {
|
|
30
|
+
sql: `${checkinsCount}`,
|
|
31
|
+
type: 'sum',
|
|
32
|
+
rollingWindow: {
|
|
33
|
+
trailing: 'unbounded'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
checkinsRolling2day: {
|
|
38
|
+
sql: `${checkinsCount}`,
|
|
39
|
+
type: 'sum',
|
|
40
|
+
rollingWindow: {
|
|
41
|
+
trailing: '2 day'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
uniqueSourceCount: {
|
|
46
|
+
sql: 'source',
|
|
47
|
+
type: 'countDistinct'
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
countDistinctApprox: {
|
|
51
|
+
sql: 'id',
|
|
52
|
+
type: 'countDistinctApprox'
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
ratio: {
|
|
56
|
+
sql: `${uniqueSourceCount} / nullif(${checkinsTotal}, 0)`,
|
|
57
|
+
type: 'number'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
dimensions: {
|
|
62
|
+
id: {
|
|
63
|
+
type: 'number',
|
|
64
|
+
sql: 'id',
|
|
65
|
+
primaryKey: true
|
|
66
|
+
},
|
|
67
|
+
source: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
sql: 'source'
|
|
70
|
+
},
|
|
71
|
+
createdAt: {
|
|
72
|
+
type: 'time',
|
|
73
|
+
sql: 'created_at'
|
|
74
|
+
},
|
|
75
|
+
checkinsCount: {
|
|
76
|
+
type: 'number',
|
|
77
|
+
sql: `${visitor_checkins.count}`,
|
|
78
|
+
subQuery: true,
|
|
79
|
+
propagateFiltersToSubQuery: true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
segments: {
|
|
84
|
+
google: {
|
|
85
|
+
sql: `source = 'google'`
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
preAggregations: {
|
|
90
|
+
default: {
|
|
91
|
+
type: 'originalSql',
|
|
92
|
+
refreshKey: {
|
|
93
|
+
sql: 'select NOW()'
|
|
94
|
+
},
|
|
95
|
+
indexes: {
|
|
96
|
+
source: {
|
|
97
|
+
columns: ['source', 'created_at']
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
partitionGranularity: 'month',
|
|
101
|
+
timeDimensionReference: createdAt
|
|
102
|
+
},
|
|
103
|
+
googleRollup: {
|
|
104
|
+
type: 'rollup',
|
|
105
|
+
measureReferences: [checkinsTotal],
|
|
106
|
+
segmentReferences: [google],
|
|
107
|
+
timeDimensionReference: createdAt,
|
|
108
|
+
granularity: 'week',
|
|
109
|
+
},
|
|
110
|
+
approx: {
|
|
111
|
+
type: 'rollup',
|
|
112
|
+
measureReferences: [countDistinctApprox],
|
|
113
|
+
timeDimensionReference: createdAt,
|
|
114
|
+
granularity: 'day'
|
|
115
|
+
},
|
|
116
|
+
multiStage: {
|
|
117
|
+
useOriginalSqlPreAggregations: true,
|
|
118
|
+
type: 'rollup',
|
|
119
|
+
measureReferences: [checkinsTotal],
|
|
120
|
+
timeDimensionReference: createdAt,
|
|
121
|
+
granularity: 'month',
|
|
122
|
+
partitionGranularity: 'day',
|
|
123
|
+
refreshKey: {
|
|
124
|
+
sql: `SELECT CASE WHEN ${FILTER_PARAMS.visitors.createdAt.filter((from, to) => `${to}::timestamp > now()`)} THEN now() END`
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
partitioned: {
|
|
128
|
+
type: 'rollup',
|
|
129
|
+
measureReferences: [checkinsTotal],
|
|
130
|
+
dimensionReferences: [source],
|
|
131
|
+
timeDimensionReference: createdAt,
|
|
132
|
+
granularity: 'day',
|
|
133
|
+
partitionGranularity: 'month',
|
|
134
|
+
refreshKey: {
|
|
135
|
+
every: '1 hour',
|
|
136
|
+
incremental: true,
|
|
137
|
+
updateWindow: '7 days'
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
partitionedHourly: {
|
|
141
|
+
type: 'rollup',
|
|
142
|
+
measureReferences: [checkinsTotal],
|
|
143
|
+
dimensionReferences: [source],
|
|
144
|
+
timeDimensionReference: createdAt,
|
|
145
|
+
granularity: 'hour',
|
|
146
|
+
partitionGranularity: 'hour'
|
|
147
|
+
},
|
|
148
|
+
partitionedHourlyForRange: {
|
|
149
|
+
type: 'rollup',
|
|
150
|
+
measureReferences: [checkinsTotal],
|
|
151
|
+
dimensionReferences: [source, createdAt],
|
|
152
|
+
timeDimensionReference: createdAt,
|
|
153
|
+
granularity: 'hour',
|
|
154
|
+
partitionGranularity: 'hour'
|
|
155
|
+
},
|
|
156
|
+
ratioRollup: {
|
|
157
|
+
type: 'rollup',
|
|
158
|
+
measureReferences: [checkinsTotal, uniqueSourceCount],
|
|
159
|
+
timeDimensionReference: createdAt,
|
|
160
|
+
granularity: 'day'
|
|
161
|
+
},
|
|
162
|
+
forJoin: {
|
|
163
|
+
type: 'rollup',
|
|
164
|
+
dimensionReferences: [id, source]
|
|
165
|
+
},
|
|
166
|
+
forJoinIncCards: {
|
|
167
|
+
type: 'rollup',
|
|
168
|
+
dimensionReferences: [id, source, cards.visitorId]
|
|
169
|
+
},
|
|
170
|
+
partitionedHourlyForJoin: {
|
|
171
|
+
type: 'rollup',
|
|
172
|
+
dimensionReferences: [id, source],
|
|
173
|
+
timeDimensionReference: createdAt,
|
|
174
|
+
granularity: 'hour',
|
|
175
|
+
partitionGranularity: 'hour'
|
|
176
|
+
},
|
|
177
|
+
partitionedRolling: {
|
|
178
|
+
type: 'rollup',
|
|
179
|
+
measureReferences: [checkinsRollingTotal, checkinsRolling2day, count],
|
|
180
|
+
dimensionReferences: [source],
|
|
181
|
+
timeDimensionReference: createdAt,
|
|
182
|
+
granularity: 'hour',
|
|
183
|
+
partitionGranularity: 'month',
|
|
184
|
+
external: true
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
cube('visitor_checkins', {
|
|
190
|
+
sql: `
|
|
191
|
+
select * from visitor_checkins
|
|
192
|
+
`,
|
|
193
|
+
|
|
194
|
+
sqlAlias: 'vc',
|
|
195
|
+
|
|
196
|
+
measures: {
|
|
197
|
+
count: {
|
|
198
|
+
type: 'count'
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
dimensions: {
|
|
203
|
+
id: {
|
|
204
|
+
type: 'number',
|
|
205
|
+
sql: 'id',
|
|
206
|
+
primaryKey: true
|
|
207
|
+
},
|
|
208
|
+
visitor_id: {
|
|
209
|
+
type: 'number',
|
|
210
|
+
sql: 'visitor_id'
|
|
211
|
+
},
|
|
212
|
+
source: {
|
|
213
|
+
type: 'string',
|
|
214
|
+
sql: 'source'
|
|
215
|
+
},
|
|
216
|
+
created_at: {
|
|
217
|
+
type: 'time',
|
|
218
|
+
sql: 'created_at'
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
preAggregations: {
|
|
223
|
+
main: {
|
|
224
|
+
type: 'originalSql'
|
|
225
|
+
},
|
|
226
|
+
forJoin: {
|
|
227
|
+
type: 'rollup',
|
|
228
|
+
measureReferences: [count],
|
|
229
|
+
dimensionReferences: [visitor_id]
|
|
230
|
+
},
|
|
231
|
+
joined: {
|
|
232
|
+
type: 'rollupJoin',
|
|
233
|
+
measureReferences: [count],
|
|
234
|
+
dimensionReferences: [visitors.source],
|
|
235
|
+
rollupReferences: [visitor_checkins.forJoin, visitors.forJoin],
|
|
236
|
+
},
|
|
237
|
+
joinedPartitioned: {
|
|
238
|
+
type: 'rollupJoin',
|
|
239
|
+
measureReferences: [count],
|
|
240
|
+
dimensionReferences: [visitors.source],
|
|
241
|
+
timeDimensionReference: visitors.createdAt,
|
|
242
|
+
granularity: 'hour',
|
|
243
|
+
rollupReferences: [visitor_checkins.forJoin, visitors.partitionedHourlyForJoin],
|
|
244
|
+
},
|
|
245
|
+
joinedIncCards: {
|
|
246
|
+
type: 'rollupJoin',
|
|
247
|
+
measureReferences: [count],
|
|
248
|
+
dimensionReferences: [visitors.source, cards.visitorId],
|
|
249
|
+
rollupReferences: [visitor_checkins.forJoin, visitors.forJoinIncCards],
|
|
250
|
+
},
|
|
251
|
+
partitioned: {
|
|
252
|
+
type: 'rollup',
|
|
253
|
+
measureReferences: [count],
|
|
254
|
+
timeDimensionReference: EveryHourVisitors.createdAt,
|
|
255
|
+
granularity: 'day',
|
|
256
|
+
partitionGranularity: 'month',
|
|
257
|
+
scheduledRefresh: true,
|
|
258
|
+
refreshRangeStart: {
|
|
259
|
+
sql: "SELECT NOW() - interval '30 day'"
|
|
260
|
+
},
|
|
261
|
+
refreshKey: {
|
|
262
|
+
every: '1 hour',
|
|
263
|
+
incremental: true,
|
|
264
|
+
updateWindow: '1 day'
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
emptyPartitioned: {
|
|
268
|
+
type: 'rollup',
|
|
269
|
+
measureReferences: [count],
|
|
270
|
+
timeDimensionReference: EmptyHourVisitors.createdAt,
|
|
271
|
+
granularity: 'hour',
|
|
272
|
+
partitionGranularity: 'month',
|
|
273
|
+
scheduledRefresh: true,
|
|
274
|
+
refreshKey: {
|
|
275
|
+
every: '1 hour',
|
|
276
|
+
incremental: true,
|
|
277
|
+
updateWindow: '1 day'
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
cube('cards', {
|
|
284
|
+
sql: `
|
|
285
|
+
select * from cards
|
|
286
|
+
`,
|
|
287
|
+
|
|
288
|
+
measures: {
|
|
289
|
+
count: {
|
|
290
|
+
type: 'count'
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
dimensions: {
|
|
295
|
+
id: {
|
|
296
|
+
type: 'number',
|
|
297
|
+
sql: 'id',
|
|
298
|
+
primaryKey: true
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
visitorId: {
|
|
302
|
+
type: 'number',
|
|
303
|
+
sql: 'visitor_id'
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
preAggregations: {
|
|
308
|
+
forJoin: {
|
|
309
|
+
type: 'rollup',
|
|
310
|
+
measureReferences: [count],
|
|
311
|
+
dimensionReferences: [visitorId]
|
|
312
|
+
},
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
cube('GoogleVisitors', {
|
|
317
|
+
refreshKey: {
|
|
318
|
+
immutable: true,
|
|
319
|
+
},
|
|
320
|
+
extends: visitors,
|
|
321
|
+
sql: `select v.* from ${visitors.sql()} v where v.source = 'google'`
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
cube('EveryHourVisitors', {
|
|
325
|
+
refreshKey: {
|
|
326
|
+
immutable: true,
|
|
327
|
+
},
|
|
328
|
+
extends: visitors,
|
|
329
|
+
sql: `select v.* from ${visitors.sql()} v where v.source = 'google'`,
|
|
330
|
+
|
|
331
|
+
preAggregations: {
|
|
332
|
+
default: {
|
|
333
|
+
type: 'originalSql',
|
|
334
|
+
refreshKey: {
|
|
335
|
+
sql: 'select NOW()'
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
partitioned: {
|
|
339
|
+
type: 'rollup',
|
|
340
|
+
measureReferences: [checkinsTotal],
|
|
341
|
+
dimensionReferences: [source],
|
|
342
|
+
timeDimensionReference: createdAt,
|
|
343
|
+
granularity: 'day',
|
|
344
|
+
partitionGranularity: 'month',
|
|
345
|
+
refreshKey: {
|
|
346
|
+
every: '1 hour',
|
|
347
|
+
incremental: true,
|
|
348
|
+
updateWindow: '1 day'
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
cube('EmptyHourVisitors', {
|
|
355
|
+
extends: EveryHourVisitors,
|
|
356
|
+
sql: `select v.* from ${visitors.sql()} v where created_at < '2000-01-01'`
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
cube('ReferenceOriginalSql', {
|
|
360
|
+
extends: visitors,
|
|
361
|
+
sql: `select v.* from ${visitors.sql()} v where v.source = 'google'`,
|
|
362
|
+
|
|
363
|
+
preAggregations: {
|
|
364
|
+
partitioned: {
|
|
365
|
+
type: 'rollup',
|
|
366
|
+
measureReferences: [count],
|
|
367
|
+
dimensionReferences: [source],
|
|
368
|
+
timeDimensionReference: createdAt,
|
|
369
|
+
granularity: 'day',
|
|
370
|
+
partitionGranularity: 'month',
|
|
371
|
+
refreshKey: {
|
|
372
|
+
every: '1 hour',
|
|
373
|
+
incremental: true,
|
|
374
|
+
updateWindow: '1 day'
|
|
375
|
+
},
|
|
376
|
+
useOriginalSqlPreAggregations: true
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
CREATE TABLE visitors (id INT, amount INT, created_at TIMESTAMP, updated_at TIMESTAMP, status INT, source TEXT, latitude DECIMAL, longitude DECIMAL);
|
|
2
|
+
CREATE TABLE visitor_checkins (id INT, visitor_id INT, created_at TIMESTAMP, source TEXT);
|
|
3
|
+
CREATE TABLE cards (id INT, visitor_id INT, visitor_checkin_id INT);
|
|
4
|
+
|
|
5
|
+
INSERT INTO
|
|
6
|
+
visitors
|
|
7
|
+
(id, amount, created_at, updated_at, status, source, latitude, longitude) VALUES
|
|
8
|
+
(1, 100, '2017-01-03', '2017-01-30', 1, 'some', 120.120, 40.60),
|
|
9
|
+
(2, 200, '2017-01-05', '2017-01-15', 1, 'some', 120.120, 58.60),
|
|
10
|
+
(3, 300, '2017-01-06', '2017-01-20', 2, 'google', 120.120, 70.60),
|
|
11
|
+
(4, 400, '2017-01-07', '2017-01-25', 2, NULL, 120.120, 10.60),
|
|
12
|
+
(5, 500, '2017-01-07', '2017-01-25', 2, NULL, 120.120, 58.10),
|
|
13
|
+
(6, 500, '2016-09-07', '2016-09-07', 2, NULL, 120.120, 58.10);
|
|
14
|
+
|
|
15
|
+
INSERT INTO
|
|
16
|
+
visitor_checkins
|
|
17
|
+
(id, visitor_id, created_at, source) VALUES
|
|
18
|
+
(1, 1, '2017-01-03', NULL),
|
|
19
|
+
(2, 1, '2017-01-04', NULL),
|
|
20
|
+
(3, 1, '2017-01-05', 'google'),
|
|
21
|
+
(4, 2, '2017-01-05', NULL),
|
|
22
|
+
(5, 2, '2017-01-05', NULL),
|
|
23
|
+
(6, 3, '2017-01-06', NULL);
|
|
24
|
+
|
|
25
|
+
INSERT INTO
|
|
26
|
+
cards
|
|
27
|
+
(id, visitor_id, visitor_checkin_id) VALUES
|
|
28
|
+
(1, 1, 1),
|
|
29
|
+
(2, 1, 2),
|
|
30
|
+
(3, 3, 6);
|
|
@@ -48,7 +48,7 @@ services:
|
|
|
48
48
|
|
|
49
49
|
cubestore:
|
|
50
50
|
container_name: birdbox-cubestore
|
|
51
|
-
image: cubejs/cubestore:${BIRDBOX_CUBESTORE_VERSION:-
|
|
51
|
+
image: cubejs/cubestore:${BIRDBOX_CUBESTORE_VERSION:-edge}
|
|
52
52
|
# Possible workaround for next version of testcontainers
|
|
53
53
|
# environment:
|
|
54
54
|
# # Workaround for Error during processing MySQL connection: peer terminated connection
|
package/dist/src/birdbox.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface BirdBoxTestCaseOptions {
|
|
2
2
|
name: string;
|
|
3
|
+
loadScript?: string;
|
|
3
4
|
}
|
|
4
5
|
export interface BirdBox {
|
|
5
6
|
stop: () => Promise<void>;
|
|
@@ -13,6 +14,8 @@ export interface BirdBox {
|
|
|
13
14
|
export declare function startBirdBoxFromContainer(options: BirdBoxTestCaseOptions): Promise<BirdBox>;
|
|
14
15
|
export interface StartCliWithEnvOptions {
|
|
15
16
|
dbType: string;
|
|
17
|
+
useCubejsServerBinary?: boolean;
|
|
18
|
+
loadScript?: string;
|
|
16
19
|
}
|
|
17
20
|
export declare function startBirdBoxFromCli(options: StartCliWithEnvOptions): Promise<BirdBox>;
|
|
18
21
|
//# sourceMappingURL=birdbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"birdbox.d.ts","sourceRoot":"","sources":["../../src/birdbox.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"birdbox.d.ts","sourceRoot":"","sources":["../../src/birdbox.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,aAAa,EAAE;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAuFjG;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAyG3F"}
|
package/dist/src/birdbox.js
CHANGED
|
@@ -33,7 +33,7 @@ async function startBirdBoxFromContainer(options) {
|
|
|
33
33
|
const env = await dc
|
|
34
34
|
.withStartupTimeout(30 * 1000)
|
|
35
35
|
.withEnv('BIRDBOX_CUBEJS_VERSION', process.env.BIRDBOX_CUBEJS_VERSION || 'latest')
|
|
36
|
-
.withEnv('BIRDBOX_CUBESTORE_VERSION', process.env.BIRDBOX_CUBESTORE_VERSION || '
|
|
36
|
+
.withEnv('BIRDBOX_CUBESTORE_VERSION', process.env.BIRDBOX_CUBESTORE_VERSION || 'edge')
|
|
37
37
|
.up();
|
|
38
38
|
const host = '127.0.0.1';
|
|
39
39
|
const port = env.getContainer('birdbox-cube').getMappedPort(4000);
|
|
@@ -52,14 +52,15 @@ async function startBirdBoxFromContainer(options) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
{
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const loadScript = options.loadScript || 'load.sh';
|
|
56
|
+
console.log(`[Birdbox] Executing ${loadScript} script`);
|
|
57
|
+
const { output, exitCode } = await env.getContainer('birdbox-db').exec([`/scripts/${loadScript}`]);
|
|
57
58
|
if (exitCode === 0) {
|
|
58
|
-
console.log(
|
|
59
|
+
console.log(`[Birdbox] Script ${loadScript} finished successfully`);
|
|
59
60
|
}
|
|
60
61
|
else {
|
|
61
62
|
console.log(output);
|
|
62
|
-
console.log(`[Birdbox] Script
|
|
63
|
+
console.log(`[Birdbox] Script ${loadScript} finished with error: ${exitCode}`);
|
|
63
64
|
await env.down();
|
|
64
65
|
process.exit(1);
|
|
65
66
|
}
|
|
@@ -102,13 +103,14 @@ async function startBirdBoxFromCli(options) {
|
|
|
102
103
|
});
|
|
103
104
|
{
|
|
104
105
|
console.log('[Birdbox] Executing load.sh script');
|
|
105
|
-
const
|
|
106
|
+
const loadScript = `/scripts/${options.loadScript || 'load.sh'}`;
|
|
107
|
+
const { output, exitCode } = await db.exec([loadScript]);
|
|
106
108
|
if (exitCode === 0) {
|
|
107
|
-
console.log(
|
|
109
|
+
console.log(`[Birdbox] Script ${loadScript} finished successfully`);
|
|
108
110
|
}
|
|
109
111
|
else {
|
|
110
112
|
console.log(output);
|
|
111
|
-
console.log(`[Birdbox] Script
|
|
113
|
+
console.log(`[Birdbox] Script ${loadScript} finished with error: ${exitCode}`);
|
|
112
114
|
await db.stop();
|
|
113
115
|
process.exit(1);
|
|
114
116
|
}
|
|
@@ -118,13 +120,14 @@ async function startBirdBoxFromCli(options) {
|
|
|
118
120
|
fs_1.default.unlinkSync(path_1.default.join(testDir, '.env'));
|
|
119
121
|
}
|
|
120
122
|
fs_extra_1.default.copySync(path_1.default.join(process.cwd(), 'birdbox-fixtures', options.dbType, 'schema'), path_1.default.join(testDir, 'schema'));
|
|
121
|
-
const cli = child_process_1.spawn('npm', ['run', 'dev'], {
|
|
122
|
-
cwd: testDir,
|
|
123
|
+
const cli = child_process_1.spawn(options.useCubejsServerBinary ? '../cubejs-server/bin/server' : 'npm', options.useCubejsServerBinary ? [] : ['run', 'dev'], {
|
|
124
|
+
cwd: options.useCubejsServerBinary ? process.cwd() : testDir,
|
|
123
125
|
shell: true,
|
|
124
126
|
// Show output of Cube.js process in console
|
|
125
127
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
126
128
|
env: {
|
|
127
129
|
...process.env,
|
|
130
|
+
CUBEJS_SCHEMA_PATH: options.useCubejsServerBinary ? path_1.default.join('birdbox-fixtures', options.dbType, 'schema') : 'schema',
|
|
128
131
|
CUBEJS_DB_TYPE: 'postgres',
|
|
129
132
|
CUBEJS_DB_HOST: db.getHost(),
|
|
130
133
|
CUBEJS_DB_PORT: `${db.getMappedPort(5432)}`,
|
package/dist/src/birdbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"birdbox.js","sourceRoot":"","sources":["../../src/birdbox.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,iDAAsC;AACtC,4DAAmC;AACnC,mDAA0D;AAC1D,mDAAsD;AACtD,wDAA+B;AAE/B,4CAAiD;AACjD,mCAA+C;
|
|
1
|
+
{"version":3,"file":"birdbox.js","sourceRoot":"","sources":["../../src/birdbox.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,iDAAsC;AACtC,4DAAmC;AACnC,mDAA0D;AAC1D,mDAAsD;AACtD,wDAA+B;AAE/B,4CAAiD;AACjD,mCAA+C;AAiBxC,KAAK,UAAU,yBAAyB,CAAC,OAA+B;;IAC7E,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,WAAW,CAAC;QACvD,MAAM,IAAI,GAAG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AC;YAEX,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC;QACD,aAAa,EAAE;YACb,aAAa,EAAE,uBAAuB;YACtC,MAAM,EAAE,qCAAqC;YAC7C,KAAK,EAAE,qBAAqB;SAC7B;KACF,CAAC;AACJ,CAAC;AAzGD,kDAyGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubejs-backend/testing",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.37",
|
|
4
4
|
"description": "Cube.js Testing Helpers",
|
|
5
5
|
"author": "Cube Dev, Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,10 +22,14 @@
|
|
|
22
22
|
"birdbox:start": "node dist/test/bin/start-birdbox.js",
|
|
23
23
|
"birdbox:postgresql": "jest --verbose -i dist/test/birdbox-postgresql.test.js",
|
|
24
24
|
"birdbox:postgresql:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-postgresql.test.js",
|
|
25
|
+
"birdbox:postgresql-pre-aggregations": "jest --verbose -i dist/test/birdbox-postgresql-pre-aggregations.test.js",
|
|
26
|
+
"birdbox:postgresql-pre-aggregations:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-postgresql-pre-aggregations.test.js",
|
|
25
27
|
"birdbox:postgresql-cubestore": "jest --verbose -i dist/test/birdbox-postgresql-cubestore.test.js",
|
|
26
28
|
"birdbox:postgresql-cubestore:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-postgresql-cubestore.test.js",
|
|
27
29
|
"birdbox:cli:postgresql": "jest --forceExit --verbose -i dist/test/cli-postgresql.test.js",
|
|
28
30
|
"birdbox:cli:postgresql:snapshot": "jest --forceExit --verbose --updateSnapshot -i dist/test/cli-postgresql.test.js",
|
|
31
|
+
"birdbox:local:postgresql-pre-aggregations": "jest --forceExit --verbose -i dist/test/cli-postgresql-pre-aggregations.test.js",
|
|
32
|
+
"birdbox:local:postgresql-pre-aggregations:snapshot": "jest --forceExit --verbose --updateSnapshot -i dist/test/cli-postgresql-pre-aggregations.test.js",
|
|
29
33
|
"cypress:install": "cypress install",
|
|
30
34
|
"cypress:birdbox": "node dist/test/bin/cypress-birdbox.js"
|
|
31
35
|
},
|
|
@@ -34,10 +38,10 @@
|
|
|
34
38
|
"birdbox-fixtures"
|
|
35
39
|
],
|
|
36
40
|
"dependencies": {
|
|
37
|
-
"@cubejs-backend/query-orchestrator": "^0.28.
|
|
38
|
-
"@cubejs-backend/schema-compiler": "^0.28.
|
|
41
|
+
"@cubejs-backend/query-orchestrator": "^0.28.37",
|
|
42
|
+
"@cubejs-backend/schema-compiler": "^0.28.37",
|
|
39
43
|
"@cubejs-backend/shared": "^0.28.29",
|
|
40
|
-
"@cubejs-client/ws-transport": "^0.28.
|
|
44
|
+
"@cubejs-client/ws-transport": "^0.28.37",
|
|
41
45
|
"fs-extra": "^8.1.0",
|
|
42
46
|
"http-proxy": "^1.18.1",
|
|
43
47
|
"node-fetch": "^2.6.1",
|
|
@@ -46,7 +50,7 @@
|
|
|
46
50
|
"devDependencies": {
|
|
47
51
|
"@4tw/cypress-drag-drop": "^1.6.0",
|
|
48
52
|
"@cubejs-backend/linter": "^0.28.22",
|
|
49
|
-
"@cubejs-client/core": "^0.28.
|
|
53
|
+
"@cubejs-client/core": "^0.28.37",
|
|
50
54
|
"@jest/globals": "^26.6.2",
|
|
51
55
|
"@types/http-proxy": "^1.17.5",
|
|
52
56
|
"@types/jest": "^26.0.22",
|
|
@@ -76,5 +80,5 @@
|
|
|
76
80
|
"eslintConfig": {
|
|
77
81
|
"extends": "../cubejs-linter"
|
|
78
82
|
},
|
|
79
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "8491774b9697362e7328846013387c8e40d28388"
|
|
80
84
|
}
|