Skip to content

Commit 4cd2729

Browse files
committed
** disable even more tests
1 parent 910f5e7 commit 4cd2729

File tree

2 files changed

+101
-97
lines changed

2 files changed

+101
-97
lines changed

ipoe/private/command/init.rkt

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -175,93 +175,94 @@
175175

176176
(define CI? (equal? "true" (getenv "CI")))
177177

178-
;; -- get-username
179-
(check-apply* (lambda (k1 k2)
180-
(check-print (list #rx"command-line$")
181-
(lambda () (get-username k1 k2))))
182-
["foo" #f == "foo"]
183-
["foo" "bar" == "foo"])
184-
185-
;; -- get-dbname
186-
(check-apply* (lambda (k1 k2)
187-
(check-print (list #rx"command-line$")
188-
(lambda () (get-username k1 k2))))
189-
["foo" #f == "foo"]
190-
["foo" "bar" == "foo"])
191-
192-
;; -- param-fallback
193-
(check-equal?
194-
(check-print (list #rx"command-line$")
195-
(lambda () (param-fallback "yes" #f #:src #f #:prompt #f #:descr #f)))
196-
"yes")
197-
198-
(check-equal?
199-
(check-print (list #rx"config file$")
200-
(lambda () (param-fallback #f "yes" #:src #f #:prompt #f #:descr #f)))
201-
"yes")
202-
203-
(define ((check-bad-param-0 p))
204-
(check-print (list #rx"^Got")
178+
(test-case "get-username"
179+
(check-apply* (lambda (k1 k2)
180+
(check-print (list #rx"command-line$")
181+
(lambda () (get-username k1 k2))))
182+
["foo" #f == "foo"]
183+
["foo" "bar" == "foo"]))
184+
185+
(test-case "get-dbname"
186+
(check-apply* (lambda (k1 k2)
187+
(check-print (list #rx"command-line$")
188+
(lambda () (get-username k1 k2))))
189+
["foo" #f == "foo"]
190+
["foo" "bar" == "foo"]))
191+
192+
(test-case "param-fallback"
193+
(check-equal?
194+
(check-print (list #rx"command-line$")
195+
(lambda () (param-fallback "yes" #f #:src #f #:prompt #f #:descr #f)))
196+
"yes")
197+
198+
(check-equal?
199+
(check-print (list #rx"config file$")
200+
(lambda () (param-fallback #f "yes" #:src #f #:prompt #f #:descr #f)))
201+
"yes")
202+
203+
(define ((check-bad-param-0 p))
204+
(check-print (list #rx"^Got")
205+
(lambda ()
206+
(param-fallback p #f #:src 'bad-param1 #:prompt "heyo" #:descr "bye"))))
207+
208+
(define ((check-bad-param-1 p))
209+
(check-print (list #rx"^Got")
210+
(lambda ()
211+
(param-fallback #f p #:src 'bad-param1 #:prompt "heyo" #:descr "bye"))))
212+
213+
(for ([bp (in-list '("54" "A1" "1_" "hello-there" "can't use this" "YO LO"))])
214+
(check-exn #rx"ipoe:init" (check-bad-param-0 bp))
215+
(check-exn #rx"ipoe:init" (check-bad-param-1 bp))
216+
(void)))
217+
218+
(test-case "psql-create-user, failure"
219+
(check-exn #rx"ipoe:init"
205220
(lambda ()
206-
(param-fallback p #f #:src 'bad-param1 #:prompt "heyo" #:descr "bye"))))
221+
(check-print (list #rx"^Checking that user")
222+
(lambda () (psql-create-user "FAKE-USER"))))))
207223

208-
(define ((check-bad-param-1 p))
209-
(check-print (list #rx"^Got")
224+
#;(test-case "psql-create-user, success"
225+
(parameterize-from-hash (options-init)
210226
(lambda ()
211-
(param-fallback #f p #:src 'bad-param1 #:prompt "heyo" #:descr "bye"))))
212-
213-
(for ([bp (in-list '("54" "A1" "1_" "hello-there" "can't use this" "YO LO"))])
214-
(check-exn #rx"ipoe:init" (check-bad-param-0 bp))
215-
(check-exn #rx"ipoe:init" (check-bad-param-1 bp))
216-
(void))
217-
218-
;; -- psql-create-user, failure
219-
(check-exn #rx"ipoe:init"
220-
(lambda ()
221-
(check-print (list #rx"^Checking that user")
222-
(lambda () (psql-create-user "FAKE-USER")))))
223-
224-
;; -- psql-create-user, success
225-
;(parameterize-from-hash (options-init)
226-
; (lambda ()
227-
; (define u (*user*))
228-
; (cond
229-
; [u
230-
; ;; User exists, let's try the test
231-
; (check-equal?
232-
; (check-print (list #rx"^Checking that user")
233-
; (lambda () (psql-create-user u)))
234-
; (void))]
235-
; [else
236-
; (displayln "TEST WARNING: cannot run psql-create-user success test, could not infer a valid DB user")])))
227+
(define u (*user*))
228+
(cond
229+
[u
230+
;; User exists, let's try the test
231+
(check-equal?
232+
(check-print (list #rx"^Checking that user")
233+
(lambda () (psql-create-user u)))
234+
(void))]
235+
[else
236+
(displayln "TEST WARNING: cannot run psql-create-user success test, could not infer a valid DB user")]))))
237237

238238
;; -- psql-create-db TODO
239239

240240
;; -- psql-create-tables TODO
241241

242-
;; -- psql-installed?, pass (machine-dependent)
243-
(when (not CI?)
244-
(check-true
245-
(check-print
246-
(list #rx"^Checking for `psql`")
247-
psql-installed?)))
242+
(test-case "psql-installed?, pass (machine-dependent)"
243+
(when (not CI?)
244+
(check-true
245+
(check-print
246+
(list #rx"^Checking for `psql`")
247+
psql-installed?))))
248248

249249
;; -- psql-installed?, fail TODO
250250

251-
;; -- psql-running, pass (machine-dependent)
252-
(when (not CI?)
253-
(check-true
254-
(check-print
255-
(list #rx"^Checking for psql server")
256-
psql-running?)))
251+
(test-case "psql-running, pass (machine-dependent)"
252+
(when (not CI?)
253+
(check-true
254+
(check-print
255+
(list #rx"^Checking for psql server")
256+
psql-running?))))
257257

258258
;; -- save-config TODO
259259

260-
;; -- start-server, pass
261-
(check-true
262-
(check-print
263-
(list
264-
#rx"^Checking"
265-
#rx"^Checking")
266-
start-server))
260+
(test-case "start-server, pass"
261+
(when (not CI?)
262+
(check-true
263+
(check-print
264+
(list
265+
#rx"^Checking"
266+
#rx"^Checking")
267+
start-server))))
267268
)

ipoe/private/parameters.rkt

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@
350350
(only-in racket/list last)
351351
(only-in racket/file file->lines))
352352

353+
(define CI? (equal? "true" (getenv "CI")))
354+
353355
(test-case "almost-option?"
354356
(check-true* almost-option?
355357
["#:key val"]
@@ -519,28 +521,29 @@
519521
(check-true (<= 0 (*bad-rhyme-penalty*)))))
520522

521523
(test-case "save-option"
522-
(with-config #:local ""
523-
(lambda ()
524-
(define-values [gc lc] (get-config-filenames))
525-
;; -- Write k/v pair to config file
526-
(define key 'hello)
527-
(define val 'world)
528-
(save-option key val #:location 'local)
529-
;; -- Check new contents against the old
530-
(define local-data (string-trim (file->string lc)))
531-
(check-equal? local-data "#:hello world")
532-
(define global-lines (if (file-exists? gc) (file->lines gc) '()))
533-
(check-equal? (options-count (options-init))
534-
(add1 (length global-lines)))))
535-
536-
(with-config #:global ""
537-
(lambda ()
538-
(define-values [gc lc] (get-config-filenames))
539-
(define key 'hello)
540-
(define val 'world)
541-
(save-option key val #:location 'global)
542-
(check-equal? (string-trim (file->string gc))
543-
(format "#:~a ~a" key val)))))
524+
(when (not CI?)
525+
(with-config #:local ""
526+
(lambda ()
527+
(define-values [gc lc] (get-config-filenames))
528+
;; -- Write k/v pair to config file
529+
(define key 'hello)
530+
(define val 'world)
531+
(save-option key val #:location 'local)
532+
;; -- Check new contents against the old
533+
(define local-data (string-trim (file->string lc)))
534+
(check-equal? local-data "#:hello world")
535+
(define global-lines (if (file-exists? gc) (file->lines gc) '()))
536+
(check-equal? (options-count (options-init))
537+
(add1 (length global-lines)))))
538+
539+
(with-config #:global ""
540+
(lambda ()
541+
(define-values [gc lc] (get-config-filenames))
542+
(define key 'hello)
543+
(define val 'world)
544+
(save-option key val #:location 'global)
545+
(check-equal? (string-trim (file->string gc))
546+
(format "#:~a ~a" key val))))))
544547

545548
(test-case "symbol->config-filename"
546549
(let-values ([(gc lc) (get-config-filenames)])

0 commit comments

Comments
 (0)