clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
devth 2019-10-29T03:06:44.071200Z

Low volume with occasional bursts of API calls (estimate 10-100 calls an hour when people play with it). It can list recent issues, search via jql, list components, versions, users, comment on issues, log work on issues, update issues, create issues. I expect we’d primary use read only features.

alexmiller 2019-10-29T03:07:44.071700Z

why would the bot comment or update on issues?

alexmiller 2019-10-29T03:08:28.072Z

who would be "playing" with it?

alexmiller 2019-10-29T03:09:00.072400Z

I'm pretty wary of having a bot make edits that obscure the actual user

alexmiller 2019-10-29T03:09:31.072900Z

why do you need to use this against the Clojure jira? can't you test against a different project?

devth 2019-10-29T03:10:27.073500Z

I didn’t mean that we would use it that way, just that it has the capability.

devth 2019-10-29T03:10:46.074100Z

Does jira provide access controls that would limit it to read only?

alexmiller 2019-10-29T03:11:14.075200Z

I don't remember the details off the top of my head

devth 2019-10-29T03:11:41.075900Z

Why this project: Because if/when I get it on Clojurians it would be fun and useful to query Clojure’s own issues in Slack

devth 2019-10-29T03:12:13.076300Z

But yes I can test against a different project

alexmiller 2019-10-29T03:15:55.076800Z

yeah, I'm not going to do all that

devth 2019-10-29T03:16:46.077Z

Haha ok

seancorfield 2019-10-29T03:23:00.077800Z

@devth I can head that off straight away as one of the Admins here: we're on a free plan and we have a general rule of not allowing any token requests or any new apps.

2019-10-29T03:24:09.079Z

(Sean is speaking from the perspective of Clojurians Slack admin here, I'm pretty sure, not Clojure JIRA)

seancorfield 2019-10-29T03:24:38.079600Z

So, if you're building this with the hope of somehow integrating Clojure's Atlassian/JIRA account into this Slack, it's not going to happen. There's already a rock solid Jira Cloud integration for Slack and we've already had to reject several requests to add that to this Slack.

seancorfield 2019-10-29T03:25:20.080600Z

Yes, as Andy says, I'm speaking as part of the Admin team for Clojurians Slack (not Cognitect-associated and not speaking on behalf of the admins of the Clojure Atlassian setup).

✅ 1
slipset 2019-10-29T13:40:54.081800Z

So, Stuart Halloway jumps in to a silly discussion @marc-omorain and I were having on twitter with this remark:

slipset 2019-10-29T13:41:04.082100Z

>@atmarc @slipset I would love to test moved out to a separate lib.

slipset 2019-10-29T13:41:37.082700Z

where “test” refers to clojure.test.

slipset 2019-10-29T13:42:21.083100Z

Would a ticket for such an endeavour be appreciated?

alexmiller 2019-10-29T13:58:11.083400Z

it's already on our list, don't need a ticket

alexmiller 2019-10-29T13:58:49.084Z

in particular, Sean Corfield and I have been talking about this for a year+ and he's got a list of items

slipset 2019-10-29T14:06:52.084500Z

nice!

alexmiller 2019-10-29T14:11:54.084900Z

general notes were archived here https://archive.clojure.org/design-wiki/display/design/clojure.test%2Bimprovements.html

slipset 2019-10-29T14:49:30.087300Z

FWIW one of the things I remember really appreciating when picking up Clojure was that it came with stuff like clojure.test and clojure.data.* included.

seancorfield 2019-10-29T15:18:28.087800Z

@slipset Link for that Twitter thread? Curious to read it.

seancorfield 2019-10-29T15:18:48.088300Z

Re: clojure.test -- I already volunteered to maintain it if it moves out of "core" for 1.11 🙂

alexmiller 2019-10-29T15:24:25.088900Z

note that it would still be included as a dependency, like spec is included, but via a separate lib that could be revved at a faster rate

alexmiller 2019-10-29T15:25:10.089400Z

so it's really about separating the release cycle more than the inclusion part

ghadi 2019-10-29T16:38:39.091400Z

"I got pinpoint accurate data" - glass half full

alexmiller 2019-10-29T16:46:56.093Z

I'd be curious how that test is being run (under lein, what clojure version, etc). Not sure that's what you'd see from just clojure.test itself.

seancorfield 2019-10-29T16:47:01.093200Z

And that stack trace is coming from Orchestra which is doing generative testing so there's not even much clojure.test could do to help.

seancorfield 2019-10-29T16:48:23.094300Z

[circleci.vm_service.vms_test$fn__39445$fn__39446 invoke form-init2759853974423263704.clj 1428]
  [com.gfredericks.test.chuck.clojure_test$_testing invokeStatic clojure_test.cljc 102]
  [com.gfredericks.test.chuck.clojure_test$_testing invoke clojure_test.cljc 100]
  [circleci.vm_service.vms_test$fn__39445 invokeStatic form-init2759853974423263704.clj 1428]
  [circleci.vm_service.vms_test$fn__39445 invoke form-init2759853974423263704.clj 1427]
  [clojure.test$test_var$fn__9737 invoke test.clj 717]
That's 80 lines into the stack trace and the first mention of clojure.test
[clj_honeycomb.core$with_event_fn invoke core.clj 465]
  [clojure.lang.AFn applyToHelper AFn.java 160]
  [clojure.lang.AFn applyTo AFn.java 144]
  [orchestra.spec.test$spec_checking_fn$fn__29295 doInvoke test.cljc 127]
That's 25 lines into the stack trace.

seancorfield 2019-10-29T16:49:35.095Z

(and the error is happening inside a fixture making the problem even harder to clean up)

alexmiller 2019-10-29T16:50:54.095500Z

I would recommend not even doing generative testing under clojure.test at all tbh

seancorfield 2019-10-29T16:51:41.096400Z

Around line 300, clojure.test did report what actually failed:

expected: (not-exception? (:result result))
  actual: (not (not-exception? #error {
 :cause "Validation failed: writeKey must not be null or empty"
so I'm not sure that first 300 lines is even coming from clojure.test TBH.

2019-10-29T16:52:38.097400Z

what disadvantages do you see to doing generative testing under clojure.test? And if not initiating generative tests that way, then you'd recommend simply invoking generative testing functions from the command line?

2019-10-29T16:53:21.098200Z

I've been doing a few generative tests in the last couple months initiated from within clojure.test deftest forms (mostly passing), and haven't noticed any problems, but perhaps because of the 'mostly passing' part?

2019-10-29T16:54:35.098900Z

I think it is just more stuff on the stack (the generation machinery can be complicated) so you get longer stacktraces

alexmiller 2019-10-29T16:55:55.101200Z

generative tests have different characteristics than typical unit tests. wanting to force them both to always run at the same frequency and importance does not imo make sense (and this reason is why there is no clojure.test integration in spec)

seancorfield 2019-10-29T16:55:57.101300Z

In this case, it's not that clojure.test printed a stacktrace, it printed an exception which happens to include a huge call chain.

alexmiller 2019-10-29T16:56:22.101700Z

^^

alexmiller 2019-10-29T16:56:52.102600Z

and I assume not-exception? is a custom test-is predicate

2019-10-29T16:56:53.102800Z

But anyone who knows that can create different clojure.test namespaces and/or deftests to control relative frequency of running example-based vs. generative tests.

2019-10-29T16:57:00.103Z

(and I am)

alexmiller 2019-10-29T16:57:12.103200Z

the knobs are different too

alexmiller 2019-10-29T16:57:45.103600Z

spec generative tests are not unit tests. why pretend they are?

2019-10-29T16:58:31.104200Z

sure. I just don't see why clojure.test is restricted to unit tests, then.

2019-10-29T16:58:54.104700Z

Not that it necessarily gives any advantages for generative testing, either.

alexmiller 2019-10-29T16:58:56.104800Z

what is it buying you?

alexmiller 2019-10-29T16:59:22.105200Z

the main advantage it gives you is to make all your tests look the same

alexmiller 2019-10-29T16:59:34.105500Z

my point is that they are not all the same, so that's a false advantage

2019-10-29T16:59:56.106700Z

I guess the best I can say is that it isn't hurting me to run them that way 🙂

alexmiller 2019-10-29T17:00:05.107200Z

it is hurting you

2019-10-29T17:00:07.107400Z

How is a generative test not a unit test? In almost all cases they are testing a single unit of code, one function.

alexmiller 2019-10-29T17:00:21.107700Z

you are wasting huge amounts of time retesting things that aren't changing

2019-10-29T17:00:54.108400Z

but I don't run the generative tests when I rerun the unit tests. I initiate them differently from the command line.

alexmiller 2019-10-29T17:01:11.108800Z

well, then you're already split, which I'd say is good

alexmiller 2019-10-29T17:03:13.111900Z

we have a vision for an entirely different kind of test runner that runs remembers what you've tested, and just retests what's affected by your change (in a smart way). I built a prototype of this two years ago but never really pulled it over the hump. hoping to get back to it after spec 2 is out.

2019-10-29T17:03:41.112500Z

I'm not here on a soapbox suggesting people use clojure.test to run generative tests -- just prompted by what you said to see if there was a harm in doing so. Wasting time is bad, agreed, but there have already been ways using clojure.test for years now to run different subsets of your tests via namespace, deftest names, Leiningen doohickies that I forget their names now, etc.

alexmiller 2019-10-29T17:05:01.113300Z

some of that is shared need, some of it is not

alexmiller 2019-10-29T17:06:08.115800Z

in clojure.test, there is organizational and runner infrastructure (some of which could be generic and really has little to do with testing per se), and there are tools for making assertions

2019-10-29T17:06:11.116Z

Maybe I understand something wrong, but every time you re-run a generative test, it could find a new bug that the last run didn't catch, due to the randomness of the test.

2019-10-29T17:06:29.116300Z

yes

alexmiller 2019-10-29T17:06:59.117500Z

generally, I would say that you should run it once for a sufficiently long time that you are satisfied it is correct. and then not test it again if it doesn't change.

2019-10-29T17:07:05.117700Z

So in my mind, I'd want my CD pipeline to run them on ever deployments

2019-10-29T17:07:11.117900Z

every*

2019-10-29T17:07:50.118600Z

But the likelihood of finding a new bug after running particular generative test for hours goes way down.

alexmiller 2019-10-29T17:08:01.118800Z

as does running it repeatedly

alexmiller 2019-10-29T17:08:17.119300Z

generative tests are a statistical argument for correctness

2019-10-29T17:08:46.120800Z

In practice, one very long run is more cumbersome than multiple small runs over time

alexmiller 2019-10-29T17:08:52.121100Z

should it be?

alexmiller 2019-10-29T17:09:00.121400Z

what if it wasn't?

2019-10-29T17:09:22.122600Z

If there are bugs to find, then after running one generative test for 'sufficiently long' (not always obvious, but practical things like "lots of time I was willing to wait"), then the most likely way to find new bugs is to tweak how the generative tests generate random data, to make them more likely to find new scenarios the old generative test never did.

alexmiller 2019-10-29T17:09:54.123900Z

what if I persisted a "database" (I'll use that very abstractly) that remembered what I had tested

2019-10-29T17:10:02.124300Z

Ya, I think what you have cooking would be better. Especially if it could do something like split samples.over runs. So the next run starts from the last sample, since I believe the samples grow as they run (maybe I'm wrong though).

alexmiller 2019-10-29T17:10:41.124800Z

they do "grow"

alexmiller 2019-10-29T17:11:26.126300Z

but that growth is rarely useful in finding new issues beyond some bound

➕ 1
2019-10-29T17:12:18.127600Z

But since that awesome generative test runner isn't out yet 😋, we have to assume there's a ton of clojure.test tests out there doing generative testing. So for that I think it makes sense for clojure.test to accept that use case as well and improve on it.

alexmiller 2019-10-29T17:12:36.127800Z

well, we disagree :)

2019-10-29T17:13:46.130800Z

Or there has to be a clear alternative. Like what should I do in the meantime to run generative tests? On a team of 10, with multiple packages worth of code?

alexmiller 2019-10-29T17:14:12.131400Z

a test suite is just a program

alexmiller 2019-10-29T17:14:17.131600Z

write a different program

alexmiller 2019-10-29T17:14:21.131800Z

provide a way to run it

2019-10-29T17:14:55.132600Z

What about my custom program would be better than using clojure.test though?

2019-10-29T17:15:23.133600Z

It would still need to run as part of build, and in CD, and it would therefore rerun just as often.

alexmiller 2019-10-29T17:15:33.133800Z

would it?

2019-10-29T17:15:55.134700Z

Unless I go all the way and build this awesome smart diff detecting generative test runner yes

alexmiller 2019-10-29T17:15:56.134800Z

why not run it less often and for longer runs?

alexmiller 2019-10-29T17:16:57.136300Z

this is a subtle and interesting question about the writing of randomized tests that could probably be the source of a thesis or two :)

2019-10-29T17:17:02.136700Z

If a defect was introduced by a code change, it needs to run prior to being released or risk breaking my service.

2019-10-29T17:17:15.137200Z

There are many commercial software dev teams that do nightly / weekly / only-before-release longer tests that are not run pre-commit.

2019-10-29T17:18:21.139500Z

Down side is of course that it isn't always obvious what changes caused the test breakage, but the cost of running those tests on every commit is simply too high to do them more often.

2019-10-29T17:18:26.139800Z

And since we currently can't detect that the code the generative test exercise has or hasn't changed, any code commits could have. So for now, I'd need them to run.

2019-10-29T17:20:07.141200Z

I'm not sure I'm following. I would never trade faster deployment for more brittle code

2019-10-29T17:20:26.141600Z

And we're not talking days of slowdown

2019-10-29T17:20:51.142400Z

You merge your code, and go to sleep, the next morning your generative tests are done running

2019-10-29T17:21:33.142500Z

I am sure. The best hardware ASIC test writer I ever met played ping pong the way he wrote tests: "never the same serve twice" 🙂

2019-10-29T17:22:33.144Z

I am reacting to your "run as part of build". Is "build" a thing you think of doing on every commit, or less often?

2019-10-29T17:23:06.145300Z

If less often, then perhaps we are in violent agreement.

2019-10-29T17:24:30.147100Z

It happens on every merge to master. But we do continuous deployment, so ever merge to master goes to production.

2019-10-29T17:25:18.147800Z

It won't run locally on your machine

2019-10-29T17:25:32.148500Z

Basically we have them scheduled same as our integration tests

2019-10-29T17:26:14.149300Z

Do you have a shorter set of automated tests you recommend team members run on every commit, even if that commit isn't merged into master? If so, likely those need to be pretty quick, to avoid slowing people down.

2019-10-29T17:27:03.150500Z

Ya, locally we only run our unit tests and some generative tests as well but the sample size is restricted so they run faster

seancorfield 2019-10-29T17:27:50.151400Z

I run tests inside my editor, for code I'm actively developing. Then we have test suites for each subproject and a CI process that runs all tests for all subprojects any given build artifact depends on.

seancorfield 2019-10-29T17:30:10.155300Z

So we essentially have three "levels" of tests -- and we do have a few clojure.test "unit" tests that run small generative tests but we also have RCFs that contain longer generative tests that we only want to run from time to time.

👍 1
seancorfield 2019-10-29T17:31:01.157600Z

Cognitect's current test runner lets you include/exclude tests based on metadata but we don't use that right now (we probably should... I should create a JIRA ticket at work for that 🙂 )

2019-10-29T17:31:27.158300Z

I kinda just agree with both of you at the same time. A test runner smart enough to only rerun a test when the code under test has changed would be awesome. Even for unit tests by the way. If the detection is accurate, like based on form instrumentation or something, then even fast tests don't need to be ran again. So if the core team is working on that, that's really awesome. But in the meantime, I don't see why writing my own test runner would be any better than leveraging the clojure.test machinery. It's just more work and can be setup to run just as often or as little as you want.

2019-10-29T17:33:13.159600Z

Like on that note, I use clojure.test for integration tests, some of them take hours to run. Are integ tests not supposed to run on clojure.test as well?

alexmiller 2019-10-29T17:37:11.160300Z

depends on if that's a good match for them

alexmiller 2019-10-29T17:37:32.160600Z

I have certainly written integration test suites that did not use clojure.test

alexmiller 2019-10-29T17:37:40.160800Z

and ones that did

alexmiller 2019-10-29T17:38:21.161200Z

I'm mostly interested in breaking people out of "there is only one way to run tests and it is clojure.test"

2019-10-29T17:39:13.161900Z

broken 🙂

alexmiller 2019-10-29T17:40:07.162900Z

I'm a big believer in doing a little bit of many test approaches

2019-10-29T17:40:53.163900Z

Do you think clojure.test is causing more harm than good?

alexmiller 2019-10-29T17:40:58.164100Z

no

alexmiller 2019-10-29T17:41:07.164400Z

we should aspirationally want more than just that though

alexmiller 2019-10-29T17:41:29.164800Z

it is an old saw that Clojure people don't write tests, which is patently false

alexmiller 2019-10-29T17:42:16.165700Z

what I would want for Clojure as a community is that we are always interested in using an array of testing strategies that is maximally effective

alexmiller 2019-10-29T17:42:29.165900Z

and not doing any one thing dogmatically

alexmiller 2019-10-29T17:43:42.167Z

it's like investment planning - do a mix of things in your investment mix

seancorfield 2019-10-29T17:44:08.167600Z

test.check has a defspec macro that pretty leads people to write generative tests that run with clojure.test runners 🙂

alexmiller 2019-10-29T17:44:24.167900Z

well, I don't run that project :)

alexmiller 2019-10-29T17:44:55.169300Z

actually, no one runs it right now, so it's a great time to start if anyone wants to :)

😢 2
2019-10-29T17:45:18.170200Z

It certainly makes it easy, but the library docs also show you how to run all the generative tests interactively, too.

seancorfield 2019-10-29T17:46:07.172500Z

Admittedly, it adds metadata so you could "easily" include/exclude such tests...

2019-10-29T17:46:31.173900Z

I'm all supportive to that, but maybe I fail to see where clojure.test plays into it. I agree we should all embrace multiple strategies to software correctnes, have CRs, have unit tests, integ tests, generative tests, run QA where it make sense, etc. Do you feel having clojure.test hurts that message?

alexmiller 2019-10-29T17:46:44.174400Z

clojure itself has both unit and generative tests (actually written with test.generative) that can be run independently. test.generative actually makes it easy to run generative tests with a time budget (ran than a count budget), which is useful.

2019-10-29T17:46:53.174600Z

Hopefully Gary Fredericks is still willing to give advice/tips on it?

alexmiller 2019-10-29T17:47:06.174800Z

he is

2019-10-29T17:47:51.176300Z

Cool. I was looking into it recently, and will ask him if there are any other sources to learn how the shrinking stuff works. The code is there, I know, but English descriptions are also nice.

alexmiller 2019-10-29T17:48:15.176700Z

I don't think clojure.test hurts anything by itself, this is more of a social question

alexmiller 2019-10-29T17:49:09.177100Z

the main sources for shrinking are the prior art in Erlang, Haskell, etc

alexmiller 2019-10-29T17:49:29.177500Z

surely there is something by John Huges or someone that explains the idea

2019-10-29T17:51:10.177900Z

Yep, will ask Gary what he knows of, in case I've missed it.

2019-10-29T17:53:07.178400Z

Funnily enough, I was just reading this today: https://hypothesis.works/articles/integrated-shrinking/

2019-10-29T17:55:21.178600Z

👋

2019-10-29T17:59:33.178700Z

Howdy. Since you've been summoned, if you happen to know any English descriptions of how test.check and/or QuickCheck implement shrinking, happy to know of those. If they are already in the test.check repo and I've missed it, apologies for the bother.

2019-10-29T18:02:55.178900Z

Hmm

2019-10-29T18:04:38.179100Z

There might not be

2019-10-29T18:05:00.179300Z

But I love explaining things and nobody ever asks me about that, so you should just ask me

❤️ 1
2019-10-29T18:05:45.179500Z

And probably a much easier question -- it seems that test.check fmap generator must have a pure function for transforming the generator's output. At least, it shouldn't do its own pseudo-random generation, because that would circumvent the ability of test.check to reproduce test cases from the seed?

2019-10-29T18:09:28.179700Z

Yes, that's the expectation

2019-10-29T18:09:51.179900Z

It'll call the function on shrinking inputs to produce shrinking outputs

2019-10-29T18:10:15.180100Z

My "Building t.c Generators" talk emphasizes this point

2019-10-29T18:10:34.180300Z

I'll take a look at that talk, then.

2019-10-29T18:11:50.180500Z

I'll let you know if I find any other resources about how the shrinking is implemented, but I'm not actively digging into that particular part of things at the moment, so sorry to ask about it then put you off, but I will definitely ask again if I start digging into that topic in depth.

2019-10-29T18:12:39.180800Z

😛 FINE

2019-10-29T18:13:09.181Z

🙂

2019-10-29T18:14:03.181200Z

reproducibility, growth, and shrinking are the main features you get by buying into the expected way of constructing generators

2019-10-29T18:15:43.181400Z

reproducibility was something I was familiar with from hardware design days long back, but automated shrinking seemed like magic the first time I heard of it.

2019-10-29T18:19:57.181600Z

It's not any more complicated than the combinators themselves

2019-10-29T18:21:29.181800Z

....sort of

cfleming 2019-10-29T23:27:27.182400Z

I agree. I’d hate to see clojure.test broken out.