80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
(test "setup for run" #t (begin (setup-for-run)
(string? (getenv "MT_RUN_AREA_HOME"))))
(test "server-register, get-best-server" '("bob" 1234) (let ((res #f))
(open-run-close tasks:server-register tasks:open-db 1 "bob" 1234 100 'live)
(set! res (open-run-close tasks:get-best-server tasks:open-db))
res))
(test "de-register server" #f (let ((res #f))
(open-run-close tasks:server-deregister tasks:open-db "bob" port: 1234)
(open-run-close tasks:get-best-server tasks:open-db)))
;; (exit)
(set! *verbosity* 3) ;; enough to trigger turning off exception handling in db accesses
(define server-pid (process-run "../../bin/megatest" (list "-server" "-" "-debug" (conc *verbosity*))))
(sleep 3)
(set! *verbosity* 1)
(define hostinfo #f)
(test #f #t (let ((dat (open-run-close tasks:get-best-server tasks:open-db)))
(set! hostinfo dat)
(and (string? (car dat))
(number? (cadr dat)))))
(test #f #t (socket? (let ((s (server:client-login (car hostinfo)(cadr hostinfo))))
(set! *runremote* s)
s)))
(define th1 (make-thread (lambda ()(server:client-setup))))
(thread-start! th1)
(test #f #t (cdb:login *runremote* *toppath* *my-client-signature*))
(test #f #t (socket? *runremote*))
(exit)
;;======================================================================
;; C O N F I G F I L E S
;;======================================================================
(define conffile #f)
(test "Read a config" #t (hash-table? (read-config "test.config" #f #f)))
|
|
|
<
<
<
<
<
<
<
|
|
|
|
|
<
>
|
>
|
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
(test "setup for run" #t (begin (setup-for-run)
(string? (getenv "MT_RUN_AREA_HOME"))))
(test "server-register, get-best-server" '("bob" 1234) (let ((res #f))
(open-run-close tasks:server-register tasks:open-db 1 "bob" 1234 100 'live)
(set! res (open-run-close tasks:get-best-server tasks:open-db))
res))
(test "de-register server" #t (let ((res #f))
(open-run-close tasks:server-deregister tasks:open-db "bob" port: 1234)
(list? (open-run-close tasks:get-best-server tasks:open-db))))
(define hostinfo #f)
(test #f #t (let ((dat (open-run-close tasks:get-best-server tasks:open-db)))
(set! hostinfo dat)
(and (string? (car dat))
(number? (cadr dat)))))
(test #f #t (let ((zmq-socket (apply server:client-connect hostinfo)))
(set! *runremote* zmq-socket)
(socket? *runremote*)))
(test #f #t (let ((res (server:client-login *runremote*)))
(car res)))
(test #f #t (socket? *runremote*))
;; (test #f #t (server:client-setup))
(test #f #t (car (cdb:login *runremote* *toppath* *my-client-signature*)))
;;======================================================================
;; C O N F I G F I L E S
;;======================================================================
(define conffile #f)
(test "Read a config" #t (hash-table? (read-config "test.config" #f #f)))
|