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> cell 4 / * <= ;
\r
17 [ ] [ "hello-world" shake-and-bake ] unit-test
\r
19 [ t ] [ 500000 small-enough? ] unit-test
\r
21 [ ] [ "sudoku" shake-and-bake ] unit-test
\r
23 [ t ] [ 800000 small-enough? ] unit-test
\r
25 [ ] [ "hello-ui" shake-and-bake ] unit-test
\r
27 [ t ] [ 1300000 small-enough? ] unit-test
\r
29 [ "staging.math-compiler-threads-ui-strip.image" ] [
\r
30 "hello-ui" deploy-config
\r
31 [ bootstrap-profile staging-image-name file-name ] bind
\r
34 [ ] [ "maze" shake-and-bake ] unit-test
\r
36 [ t ] [ 1200000 small-enough? ] unit-test
\r
38 ! [ ] [ "tetris" shake-and-bake ] unit-test
\r
40 ! [ t ] [ 1500000 small-enough? ] unit-test
\r
42 [ ] [ "bunny" shake-and-bake ] unit-test
\r
44 [ t ] [ 2500000 small-enough? ] unit-test
\r
46 : run-temp-image ( -- )
\r
48 "-i=" "test.image" temp-file append
\r
49 2array try-process ;
\r
52 "tools.deploy.test.1"
\r
53 "tools.deploy.test.2"
\r
54 "tools.deploy.test.3"
\r
55 "tools.deploy.test.4"
\r
63 USING: http.client http.server http.server.dispatchers
\r
64 http.server.responses http.server.static io.servers.connection ;
\r
66 SINGLETON: quit-responder
\r
68 M: quit-responder call-responder*
\r
69 2drop stop-this-server "Goodbye" "text/html" <content> ;
\r
71 : add-quot-responder ( responder -- responder )
\r
72 quit-responder "quit" add-responder ;
\r
75 #! Return as soon as server is running.
\r
85 "resource:basis/http/test" <static> >>default
\r
93 "tools.deploy.test.5" shake-and-bake
\r
97 [ ] [ "http://localhost:1237/quit" http-get 2drop ] unit-test
\r
100 "tools.deploy.test.6" shake-and-bake
\r