1 IN: tools.deploy.tests
\r
2 USING: tools.test system io.files kernel tools.deploy.config
\r
3 tools.deploy.backend math sequences io.launcher arrays
\r
4 namespaces continuations layouts accessors ;
\r
6 : shake-and-bake ( vocab -- )
\r
7 [ "test.image" temp-file delete-file ] ignore-errors
\r
10 "test.image" temp-file
\r
11 r> dup deploy-config make-deploy-image
\r
14 : small-enough? ( n -- ? )
\r
15 >r "test.image" temp-file file-info size>> r> <= ;
\r
17 [ ] [ "hello-world" shake-and-bake ] unit-test
\r
20 cell 8 = 8 5 ? 100000 * small-enough?
\r
23 [ ] [ "sudoku" shake-and-bake ] unit-test
\r
26 cell 8 = 20 10 ? 100000 * small-enough?
\r
29 [ ] [ "hello-ui" shake-and-bake ] unit-test
\r
31 [ "staging.math-compiler-ui-strip.image" ] [
\r
32 "hello-ui" deploy-config
\r
33 [ bootstrap-profile staging-image-name file-name ] bind
\r
37 cell 8 = 35 17 ? 100000 * small-enough?
\r
40 [ ] [ "maze" shake-and-bake ] unit-test
\r
43 cell 8 = 30 15 ? 100000 * small-enough?
\r
46 [ ] [ "bunny" shake-and-bake ] unit-test
\r
49 cell 8 = 50 30 ? 100000 * small-enough?
\r
53 "tools.deploy.test.1"
\r
54 "tools.deploy.test.2"
\r
55 "tools.deploy.test.3"
\r
56 "tools.deploy.test.4"
\r
61 "-i=" "test.image" temp-file append
\r
66 USING: http.client http.server http.server.dispatchers
\r
67 http.server.responses http.server.static io.servers.connection ;
\r
69 SINGLETON: quit-responder
\r
71 M: quit-responder call-responder*
\r
72 2drop stop-server "Goodbye" "text/html" <content> ;
\r
74 : add-quot-responder ( responder -- responder )
\r
75 quit-responder "quit" add-responder ;
\r
78 #! Return as soon as server is running.
\r
88 "resource:extra/http/test" <static> >>default
\r
96 "tools.deploy.test.5" shake-and-bake
\r
98 "-i=" "test.image" temp-file append
\r
102 [ ] [ "http://localhost:1237/quit" http-get 2drop ] unit-test
\r