Skip to content

Commit 4743285

Browse files
authored
chore(sf): allow slow tests in snowflake (#561)
1 parent f4b0157 commit 4743285

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

clouds/snowflake/modules/Makefile

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ else
2626
BAIL=--bail
2727
endif
2828

29+
SLOW_NAMING_REGEX ?= \.slow\.test\.js$$
30+
2931
REPLACEMENTS = "SF_SCHEMA SF_VERSION_FUNCTION SF_PACKAGE_VERSION SF_SHARE APP_ROLE"
3032
NATIVE_APP_REPLACEMENTS = "SF_APP_SCHEMA APP_ROLE"
3133

3234
include $(COMMON_DIR)/Makefile
3335

3436
.SILENT:
3537

36-
.PHONY: help lint build build-share build-native-app-setup-script deploy deploy-share test remove remove-functions remove-share clean
38+
.PHONY: help lint build build-share build-native-app-setup-script deploy deploy-share test test-fast test-slow remove remove-functions remove-share clean
3739

3840
help:
3941
echo "Available targets: lint build deploy test remove remove-functions clean"
@@ -97,12 +99,36 @@ deploy-share: check build-share
9799

98100
test: check $(NODE_MODULES_DEV)
99101
echo "Testing modules..."
102+
$(MAKE) test-fast
103+
$(MAKE) test-slow
104+
105+
test-fast: check $(NODE_MODULES_DEV)
106+
for m in $(shell ls $(TEST_DIR)); do \
107+
TESTS=`$(COMMON_DIR)/list_functions.js $$m --diff="$(diff)" --modules=$(modules) --functions=$(functions)`; \
108+
if [ ! -z "$$TESTS" ]; then \
109+
FLAGS=`echo "$$TESTS" | tr ' ' '\n' | grep '^--global' | tr '\n' ' '`; \
110+
TEST_FILES=`echo "$$TESTS" | tr ' ' '\n' | grep '\.test\.js$$'`; \
111+
FAST_TESTS=`echo "$$TEST_FILES" | grep -Ev "$(SLOW_NAMING_REGEX)" | tr '\n' ' '`; \
112+
if [ ! -z "$$FAST_TESTS" ]; then \
113+
PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \
114+
jest --testTimeout=50000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$FAST_TESTS $$FLAGS \
115+
--setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \
116+
fi; \
117+
fi; \
118+
done;
119+
120+
test-slow: check $(NODE_MODULES_DEV)
100121
for m in $(shell ls $(TEST_DIR)); do \
101122
TESTS=`$(COMMON_DIR)/list_functions.js $$m --diff="$(diff)" --modules=$(modules) --functions=$(functions)`; \
102123
if [ ! -z "$$TESTS" ]; then \
103-
PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \
104-
jest --testTimeout=50000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$TESTS \
105-
--setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \
124+
FLAGS=`echo "$$TESTS" | tr ' ' '\n' | grep '^--global' | tr '\n' ' '`; \
125+
TEST_FILES=`echo "$$TESTS" | tr ' ' '\n' | grep '\.test\.js$$'`; \
126+
SLOW_TESTS=`echo "$$TEST_FILES" | grep -E "$(SLOW_NAMING_REGEX)" | tr '\n' ' '`; \
127+
if [ ! -z "$$SLOW_TESTS" ]; then \
128+
PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \
129+
jest --runInBand --testTimeout=150000 $(BAIL) --verbose --slowTestThreshold=20 $$SLOW_TESTS $$FLAGS \
130+
--setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \
131+
fi; \
106132
fi; \
107133
done;
108134

0 commit comments

Comments
 (0)