This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-23
Channels
- # announcements (2)
- # babashka (56)
- # beginners (30)
- # calva (79)
- # cider (5)
- # circleci (3)
- # clj-kondo (84)
- # cljfx (2)
- # cljsrn (3)
- # clojure (264)
- # clojure-czech (3)
- # clojure-europe (18)
- # clojure-spec (3)
- # clojurescript (12)
- # conjure (28)
- # cursive (5)
- # datomic (4)
- # deps-new (22)
- # fulcro (6)
- # graalvm (3)
- # jobs (1)
- # malli (1)
- # off-topic (23)
- # pathom (4)
- # portal (3)
- # practicalli (2)
- # quil (6)
- # reagent (20)
- # remote-jobs (3)
- # reveal (14)
- # ring (10)
- # shadow-cljs (5)
- # spacemacs (4)
- # xtdb (4)
Question about running tests again 🙂
.
├── run-test.sh
├── src
│ └── cap
└── test
└── cap
├── test_a.clj
└── test_b.clj
#test_a.clj
(ns cap.test-a (:require [clojure.test :as t :refer [deftest, is]]))
(deftest test-simple-pass
(is (= 2 (+ 1 1))))
#test_b.clj
(ns cap.test-b (:require [clojure.test :as t :refer [deftest, is]]))
(deftest test-simple-fail
(is (= 3 (+ 1 1))))
I can run a single test file with the recipe like:
#!/usr/bin/env bash
bb -cp "src:test:resources" \
-e "(require '[clojure.test :as t] '[cap.test-a])
(let [{:keys [:fail :error]} (t/run-tests 'cap.test-a)]
(System/exit (+ fail error)))"
But how can i run all tests? Also the tests from test_b.clj
@marco.pasopas you should also require the b namespace and you can use run-all-tests from Clojure.test
@borkdude something like this??
#!/usr/bin/env bash
bb -cp "src:test:resources" \
-e "(require '[clojure.test :as t] '[cap.test-a] '[cap.test-b])
(let [{:keys [:fail :error]} (t/run-all-tests)]
(System/exit (+ fail error)))"
This also runs the tests like
Testing cap.test-a
Testing bencode.core
Testing clj-yaml.core
Testing clojure.java.browse
Would it be more idiomatic to create somekind of test runner namespace or something?
Yes, you can just add the name to run-tests. You can add multiple namespaces there. I updated the book to make this a test runner script instead of a command line expression
Awesome! I was just going to add tests to the internal CLI of the company that I work for.
Btw, do you have any suggestion for easy mocking in Babashaka for tests?
I've being using match which gives me a easy way to mach cases for sh
calls like this:
(match args
["aws" "s3" "cp" "" _] (spit (nth args 4) new-features-config)
["aws" "s3" "cp" _ ""] nil
["rm" _] (io/delete-file (second args))
:else (throw (ex-info "unexpected sh call: " args)))))
But as I'm not sure this will work on babashka, I'm running the tests in Clojure@URUTKFS0H is this core.match?
wow! awesome! thanks!
@URUTKFS0H now released as 0.2.8
Just set up the test runner and the CI using babashka 0.2.8! It worked great including the tests with core.match! Thanks!
Apologies for asking dumb questions 🙂 , still need to get used to the Clojure / BB ecosystem
I am looking into including hiccup in babashka for static site generation, but the standard hiccup library doesn't work with GraalVM, since it's based on ... eval
😲
Does anyone know of a less "minimal" babashka docker image to use in CI (one that includes e.g. git)
@polymeris There is now a babashka/babashka image and also a babashka-alpine image. The first one is based on ubuntu and the second one on alpine. Both come with curl (for babashka.curl) but nothing more than that. Just derive another image from it.
Where can I download a pre-built sql pod binary?
No, for me. I supposed that once merged, a binary for each DB and linux/Mac is built and published somewhere. Or do I always need to build pods myself? (for Linux)
(I want to include it in my aws lambda on Monday and would be happy not to need adding a build stage for it)
I get that. We can distribute it on the pod registry, but I need to know absolutely sure we are not offending any licenses
Will verify the license
I hate Oracle. I will need to try to check this with our legal department. Signals from the internet are ambiguous.
Helidon itself has Apache but their driver is literally wrapped ojdbc + reflection json
https://github.com/oracle/helidon/blob/master/integrations/db/ojdbc/pom.xml only mentions Apache
Maybe post an issue on the Helidon issue tracker to ask how this should be considered?
As for the pod-registry, I will not distribute it in case of doubt, don't want the legal department of Oracle on my back
So you could maybe build it yourself locally and send it along with your AWS Lambda image
@holyjak For the time being, you can download it from here: https://app.circleci.com/pipelines/github/babashka/babashka-sql-pods/103/workflows/07264b48-367b-43e5-88f4-18784deecab8/jobs/341/artifacts This link will expire in 30 days
Thank you very much!
Ah, found the issue with hiccup. You have to take care to not map the html
macro inside the sci interpreter, but a function, wrapping the macro call, to avoid hiccup to go into "compilation" mode which uses eval
😅
Is there a way to interactively develop something with the lanterna pod? This fork doesnt make use of the swing terminal so I was wondering what others have done. (Just remembered that prepl exists so will look further into that)
@bret.horne I read that GraalVM 21 has support now for Swing on linux (https://medium.com/graalvm/graalvm-21-0-introducing-a-new-way-to-run-java-df894256de28) but it's experimental, this is why the lanterna pod doesn't have Swing yet. As for interactive development, there is a socket REPL, pREPL and nREPL in bb
Also, thank you for your work on this btw. I love being able to run clojure in production now for tooling 🙂
I gotcha.
I tried using nrepl first and connecting to that way, in emacs via cider-connect, but im not entirely sure how its supposed to work. The terminal seems to blend in with the repl and I lose all connection to it despite shutting down the terminal.
fwiw, a lot of the times, I just re-run the scripts I'm developing until it works, since the startup is so fast, the difference with a REPL isn't that big
true. I tried using your clojure-lanterna fork directly and using javac to compile it as im not a lein user but use clj instead.
so Ill continue down that path to run it on the jvm.
nrepl > /dev/tty seems to work well enough