clj-commons / pomegranate

A sane Clojure API for Maven Artifact Resolver + dynamic runtime modification of the classpath
507 stars 61 forks source link

chore: manual tests before next release #163

Closed lread closed 1 year ago

lread commented 1 year ago

I'll do some sanity testing before the next release.

lread commented 1 year ago

For lein seems like they are currently testing on codeberg via woodpecker. I'll effectively carry out the same tests but against Pomegranate master head.

lread commented 1 year ago

Testing against leiningen

Summary

Leiningen tests needed one correction to pass. See: https://codeberg.org/lread/leiningen/commit/d2fdfcba577964f4bba28821ad1deab026f198d4

The test was using an invalid value for the :checksum option. See below for details.

How is leiningen testing on CI?

Leiningen is testing on codeberg via woodpecker with this config:

pipeline:
  build:
    image: debian:stable-slim
    commands:
      - apt-get update -qq && apt-get install -y gnupg leiningen netcat-openbsd openssh-client
      - cd leiningen-core && lein bootstrap
      - cd .. && bin/lein test

Setup

I've gone ahead and forked leiningen over at codeberg: https://codeberg.org/lread/leiningen I'll be using this fork in tests.

To reduce test time, I created a docker image via make-docker-image.sh:

#!/usr/bin/env bash
set -xeou pipefail

POM_PATH=.m2/repository/clj-commons/pomegranate/1.2.22

# Install pomegranate to local m2 repo, will be version 1.2.22
git clone https://github.com/clj-commons/pomegranate pomegranate-testing
cd pomegranate-testing
bb install
cd ..
rm -rf pomegranate-testing

# docker can't copy from absolute paths
mkdir -p ${POM_PATH}
cp -r ~/${POM_PATH}/* ${POM_PATH}

cat <<EOF > Dockerfile
FROM debian:stable-slim

# Basic setup (added git)
RUN apt-get update -qq \
    && apt-get install -y gnupg leiningen netcat-openbsd openssh-client \
    && apt-get install -y git

# Clone my fork of leiningen
RUN git clone https://codeberg.org/lread/leiningen.git

# Copy over pomegranate local deployment
RUN mkdir -p /root/${POM_PATH}
COPY ${POM_PATH} /root/${POM_PATH}

# Copy over our test runner
COPY testing123.sh /testing123.sh

EOF

docker build --no-cache -t lread/leinpomtest .

Which incorporates testing123.sh:

#!/usr/bin/env bash
set -xeou pipefail

TEST_BRANCH=$1

# dump image os info
cat /etc/*-release

# select lein branch to test against
cd leiningen
git switch ${TEST_BRANCH}

# sanity - make sure we are testing what we think we are
git diff main

# continue with woodpecker cmds to test
cd leiningen-core
lein bootstrap
cd ..
bin/lein test

# deps tree is interesting, lets dump it
echo "dumping deps"
bin/lein deps :tree

And then I used lein-pom-test.sh to launch tests:

#!/usr/bin/env bash
set -xeou pipefail
TEST_BRANCH=$1
docker run -i lread/leinpomtest /bin/bash /testing123.sh ${TEST_BRANCH}

Test run 1: sanity - run existing leiningen tests as is

./lein-pom-test.sh main

Good, this works.

deps tree dump for the curious ```Clojure [commons-codec "1.15"] [commons-io "2.8.0"] [commons-lang "2.6"] [leiningen-core "2.10.1-SNAPSHOT"] [clj-commons/pomegranate "1.2.1" :exclusions [[org.slf4j/jcl-over-slf4j] [org.slf4j/slf4j-api] [org.apache.maven.wagon/wagon-provider-api] [org.apache.httpcomponents/httpcore] [org.apache.httpcomponents/httpclient]]] [org.apache.maven.resolver/maven-resolver-api "1.3.3"] [org.apache.maven.resolver/maven-resolver-connector-basic "1.3.3"] [org.apache.maven.resolver/maven-resolver-impl "1.3.3"] [org.apache.maven.resolver/maven-resolver-spi "1.3.3"] [org.apache.maven.resolver/maven-resolver-transport-file "1.3.3"] [org.apache.maven.resolver/maven-resolver-transport-http "1.3.3"] [org.apache.maven.resolver/maven-resolver-transport-wagon "1.3.3"] [org.apache.maven.resolver/maven-resolver-util "1.3.3"] [org.apache.maven/maven-resolver-provider "3.6.1"] [javax.inject "1"] [org.apache.maven/maven-model-builder "3.6.1"] [org.apache.maven/maven-artifact "3.6.1"] [org.apache.commons/commons-lang3 "3.8.1"] [org.apache.maven/maven-builder-support "3.6.1"] [org.codehaus.plexus/plexus-component-annotations "1.7.1" :exclusions [[junit]]] [org.codehaus.plexus/plexus-interpolation "1.25"] [org.apache.maven/maven-model "3.6.1"] [org.apache.maven/maven-repository-metadata "3.6.1"] [com.hypirion/io "0.3.1"] [org.apache.maven.wagon/wagon-http "3.5.2" :exclusions [[org.slf4j/slf4j-api]]] [org.apache.httpcomponents/httpclient "4.5.13" :exclusions [[commons-logging]]] [org.apache.httpcomponents/httpcore "4.4.15"] [org.apache.maven.wagon/wagon-http-shared "3.5.2"] [org.apache.maven.wagon/wagon-provider-api "3.5.2"] [org.codehaus.plexus/plexus-utils "3.3.0"] [org.slf4j/jcl-over-slf4j "1.7.32" :scope "runtime"] [org.clojure/clojure "1.11.1"] [org.clojure/core.specs.alpha "0.2.62"] [org.clojure/spec.alpha "0.3.218"] [org.clojure/tools.macro "0.1.5"] [org.flatland/classlojure "0.7.1"] [org.slf4j/slf4j-nop "1.7.25"] [org.slf4j/slf4j-api "1.7.25"] [robert/hooke "1.3.0"] [net.cgrand/parsley "0.9.3" :exclusions [[org.clojure/clojure]]] [nrepl "1.0.0"] [org.clojars.trptcolin/sjacket "0.1.1.1" :exclusions [[org.clojure/clojure]]] [net.cgrand/regex "1.1.0"] [org.clojure/data.xml "0.2.0-alpha6"] [org.clojure/data.codec "0.1.0"] [org.nrepl/incomplete "0.1.0" :exclusions [[org.clojure/clojure]]] [scout "0.1.1"] [stencil "0.5.0" :exclusions [[org.clojure/core.cache]]] [quoin "0.1.2"] [timofreiberg/bultitude "0.3.0" :exclusions [[org.clojure/clojure]]] [org.tcrawley/dynapath "1.0.0"] ```

Test run 2 - against new Pomegranate - don't be pedantic

For this run, to get tests to pass, I made 3 changes to leiningen:

Change 1 - bump pomegranate

Bump pomegranate to my test version 1.2.22

Change 2 - turn off pedantic

Remove :pedantic? :abort from leningen project.clj

Change 3 - fix bad :checksum option in tests

Overcome failures in tests

  • leiningen.core.test.pedantic/top-level-overrides-transative-later
  • leiningen.core.test.pedantic/range-causes-other-transative-to-ignore-top-level

These tests rely on setup with an invalid option of :checksum false. This now fails because of a fix for https://issues.apache.org/jira/browse/MRESOLVER-151. Looks like :checksum false would have happened to translate to :checksum :warn, although I think the intent was probably :checksum :ignore.

You can see the changes here: https://codeberg.org/lread/leiningen/compare/main...lread-test-pomegranate-fix1

To test:

./lein-pom-test.sh lread-test-pomegranate-fix1

This passes.

deps tree dump for the curious ```Clojure Possibly confusing dependencies found: [leiningen-core "2.10.1-SNAPSHOT"] -> [org.apache.maven.wagon/wagon-http "3.5.2" :exclusions [org.slf4j/slf4j-api]] overrides [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven.wagon/wagon-http "3.5.3"] Consider using these exclusions: [leiningen-core "2.10.1-SNAPSHOT" :exclusions [org.apache.maven.wagon/wagon-http]] [timofreiberg/bultitude "0.3.0" :exclusions [org.clojure/clojure]] -> [org.tcrawley/dynapath "1.0.0"] overrides [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.tcrawley/dynapath "1.1.0"] Consider using these exclusions: [leiningen-core "2.10.1-SNAPSHOT" :exclusions [org.tcrawley/dynapath]] [leiningen-core "2.10.1-SNAPSHOT"] -> [org.apache.maven.wagon/wagon-http "3.5.2" :exclusions [org.slf4j/slf4j-api]] -> [org.apache.maven.wagon/wagon-http-shared "3.5.2"] overrides [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven.wagon/wagon-http "3.5.3"] -> [org.apache.maven.wagon/wagon-http-shared "3.5.3"] Consider using these exclusions: [leiningen-core "2.10.1-SNAPSHOT" :exclusions [org.apache.maven.wagon/wagon-http-shared]] [leiningen-core "2.10.1-SNAPSHOT"] -> [org.apache.maven.wagon/wagon-http "3.5.2" :exclusions [org.slf4j/slf4j-api]] -> [org.codehaus.plexus/plexus-utils "3.3.0"] overrides [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven/maven-resolver-provider "3.8.7"] -> [org.apache.maven/maven-model-builder "3.8.7"] -> [org.apache.maven/maven-artifact "3.8.7"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven/maven-resolver-provider "3.8.7"] -> [org.apache.maven/maven-model-builder "3.8.7"] -> [org.apache.maven/maven-model "3.8.7"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven.wagon/wagon-ssh "3.5.3"] -> [org.apache.maven.wagon/wagon-ssh-common "3.5.3"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven.wagon/wagon-http "3.5.3"] -> [org.apache.maven.wagon/wagon-http-shared "3.5.3"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven/maven-resolver-provider "3.8.7"] -> [org.apache.maven/maven-repository-metadata "3.8.7"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven/maven-resolver-provider "3.8.7"] -> [org.apache.maven/maven-model-builder "3.8.7"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven/maven-resolver-provider "3.8.7"] -> [org.apache.maven/maven-model "3.8.7"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven.wagon/wagon-ssh "3.5.3"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] and [leiningen-core "2.10.1-SNAPSHOT"] -> [clj-commons/pomegranate "1.2.22" :exclusions [org.slf4j/jcl-over-slf4j org.slf4j/slf4j-api org.apache.maven.wagon/wagon-provider-api org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient]] -> [org.apache.maven/maven-resolver-provider "3.8.7"] -> [org.codehaus.plexus/plexus-utils "3.3.1"] Consider using these exclusions: [leiningen-core "2.10.1-SNAPSHOT" :exclusions [org.codehaus.plexus/plexus-utils]] [commons-codec "1.15"] [commons-io "2.8.0"] [commons-lang "2.6"] [leiningen-core "2.10.1-SNAPSHOT"] [clj-commons/pomegranate "1.2.22" :exclusions [[org.slf4j/jcl-over-slf4j] [org.slf4j/slf4j-api] [org.apache.maven.wagon/wagon-provider-api] [org.apache.httpcomponents/httpcore] [org.apache.httpcomponents/httpclient]]] [org.apache.maven.resolver/maven-resolver-api "1.9.4"] [org.apache.maven.resolver/maven-resolver-connector-basic "1.9.4"] [org.apache.maven.resolver/maven-resolver-impl "1.9.4"] [org.apache.commons/commons-lang3 "3.12.0"] [org.apache.maven.resolver/maven-resolver-named-locks "1.9.4"] [org.apache.maven.resolver/maven-resolver-spi "1.9.4"] [org.apache.maven.resolver/maven-resolver-transport-file "1.9.4"] [org.apache.maven.resolver/maven-resolver-transport-http "1.9.4"] [org.apache.maven.resolver/maven-resolver-transport-wagon "1.9.4"] [org.apache.maven.resolver/maven-resolver-util "1.9.4"] [org.apache.maven.wagon/wagon-ssh "3.5.3"] [com.jcraft/jsch.agentproxy.connector-factory "0.0.9"] [com.jcraft/jsch.agentproxy.core "0.0.9"] [com.jcraft/jsch.agentproxy.pageant "0.0.9"] [com.jcraft/jsch.agentproxy.sshagent "0.0.9"] [com.jcraft/jsch.agentproxy.usocket-jna "0.0.9"] [net.java.dev.jna/jna-platform "4.1.0"] [net.java.dev.jna/jna "4.1.0"] [com.jcraft/jsch.agentproxy.usocket-nc "0.0.9"] [com.jcraft/jsch.agentproxy.jsch "0.0.9"] [com.jcraft/jsch "0.1.55"] [org.apache.maven.wagon/wagon-ssh-common "3.5.3"] [org.codehaus.plexus/plexus-interactivity-api "1.1" :exclusions [[plexus/plexus-utils] [org.codehaus.plexus/plexus-container-default] [classworlds]]] [org.apache.maven/maven-resolver-provider "3.8.7"] [javax.inject "1"] [org.apache.maven/maven-model-builder "3.8.7"] [org.apache.maven/maven-artifact "3.8.7"] [org.apache.maven/maven-builder-support "3.8.7"] [org.codehaus.plexus/plexus-interpolation "1.26"] [org.eclipse.sisu/org.eclipse.sisu.inject "0.3.5"] [org.apache.maven/maven-model "3.8.7"] [org.apache.maven/maven-repository-metadata "3.8.7"] [com.hypirion/io "0.3.1"] [org.apache.maven.wagon/wagon-http "3.5.2" :exclusions [[org.slf4j/slf4j-api]]] [org.apache.httpcomponents/httpclient "4.5.13" :exclusions [[commons-logging]]] [org.apache.httpcomponents/httpcore "4.4.15"] [org.apache.maven.wagon/wagon-http-shared "3.5.2"] [org.apache.maven.wagon/wagon-provider-api "3.5.2"] [org.codehaus.plexus/plexus-utils "3.3.0"] [org.slf4j/jcl-over-slf4j "1.7.32" :scope "runtime"] [org.clojure/clojure "1.11.1"] [org.clojure/core.specs.alpha "0.2.62"] [org.clojure/spec.alpha "0.3.218"] [org.clojure/tools.macro "0.1.5"] [org.flatland/classlojure "0.7.1"] [org.slf4j/slf4j-nop "1.7.25"] [org.slf4j/slf4j-api "1.7.25"] [robert/hooke "1.3.0"] [net.cgrand/parsley "0.9.3" :exclusions [[org.clojure/clojure]]] [nrepl "1.0.0"] [org.clojars.trptcolin/sjacket "0.1.1.1" :exclusions [[org.clojure/clojure]]] [net.cgrand/regex "1.1.0"] [org.clojure/data.xml "0.2.0-alpha6"] [org.clojure/data.codec "0.1.0"] [org.nrepl/incomplete "0.1.0" :exclusions [[org.clojure/clojure]]] [scout "0.1.1"] [stencil "0.5.0" :exclusions [[org.clojure/core.cache]]] [quoin "0.1.2"] [timofreiberg/bultitude "0.3.0" :exclusions [[org.clojure/clojure]]] [org.tcrawley/dynapath "1.0.0"] ```

Test run 3 - against new Pomegranate - be pedantic

I figured it would be interesting to try again but this time without turning pedantic off. I can't easily tell what is an override of a transitive dep vs an explicitly used dep in leiningen. And I don't have any real understanding of leiningen source. But I can guess, I suppose.

So I created a new branch lread-test-pomegranate-fix2 which naively tries to use pomegranate dep versions.

Changes are: https://codeberg.org/lread/leiningen/compare/main...lread-test-pomegranate-fix2

To test:

./lein-pom-test.sh lread-test-pomegranate-fix2

This passes. I expect the leiningen team has their own ideas of when to update deps, but nice to know everything passes using all latest pomegranate deps.

deps tree dump for the curious ```Clojure [commons-codec "1.15"] [commons-io "2.8.0"] [commons-lang "2.6"] [leiningen-core "2.10.1-SNAPSHOT"] [clj-commons/pomegranate "1.2.22" :exclusions [[org.slf4j/jcl-over-slf4j] [org.slf4j/slf4j-api]]] [org.apache.httpcomponents/httpclient "4.5.14"] [commons-logging "1.2"] [org.apache.httpcomponents/httpcore "4.4.16"] [org.apache.maven.resolver/maven-resolver-api "1.9.4"] [org.apache.maven.resolver/maven-resolver-connector-basic "1.9.4"] [org.apache.maven.resolver/maven-resolver-impl "1.9.4"] [org.apache.commons/commons-lang3 "3.12.0"] [org.apache.maven.resolver/maven-resolver-named-locks "1.9.4"] [org.apache.maven.resolver/maven-resolver-spi "1.9.4"] [org.apache.maven.resolver/maven-resolver-transport-file "1.9.4"] [org.apache.maven.resolver/maven-resolver-transport-http "1.9.4"] [org.apache.maven.resolver/maven-resolver-transport-wagon "1.9.4"] [org.apache.maven.resolver/maven-resolver-util "1.9.4"] [org.apache.maven.wagon/wagon-http "3.5.3"] [org.apache.maven.wagon/wagon-http-shared "3.5.3"] [org.apache.maven.wagon/wagon-provider-api "3.5.3" :exclusions [[org.codehaus.plexus/plexus-utils]]] [org.apache.maven.wagon/wagon-ssh "3.5.3"] [com.jcraft/jsch.agentproxy.connector-factory "0.0.9"] [com.jcraft/jsch.agentproxy.core "0.0.9"] [com.jcraft/jsch.agentproxy.pageant "0.0.9"] [com.jcraft/jsch.agentproxy.sshagent "0.0.9"] [com.jcraft/jsch.agentproxy.usocket-jna "0.0.9"] [net.java.dev.jna/jna-platform "4.1.0"] [net.java.dev.jna/jna "4.1.0"] [com.jcraft/jsch.agentproxy.usocket-nc "0.0.9"] [com.jcraft/jsch.agentproxy.jsch "0.0.9"] [com.jcraft/jsch "0.1.55"] [org.apache.maven.wagon/wagon-ssh-common "3.5.3"] [org.codehaus.plexus/plexus-interactivity-api "1.1" :exclusions [[plexus/plexus-utils] [org.codehaus.plexus/plexus-container-default] [classworlds]]] [org.apache.maven/maven-resolver-provider "3.8.7"] [javax.inject "1"] [org.apache.maven/maven-model-builder "3.8.7"] [org.apache.maven/maven-artifact "3.8.7"] [org.apache.maven/maven-builder-support "3.8.7"] [org.codehaus.plexus/plexus-interpolation "1.26"] [org.eclipse.sisu/org.eclipse.sisu.inject "0.3.5"] [org.apache.maven/maven-model "3.8.7"] [org.apache.maven/maven-repository-metadata "3.8.7"] [org.codehaus.plexus/plexus-utils "3.3.1"] [org.tcrawley/dynapath "1.1.0"] [com.hypirion/io "0.3.1"] [org.clojure/clojure "1.11.1"] [org.clojure/core.specs.alpha "0.2.62"] [org.clojure/spec.alpha "0.3.218"] [org.clojure/tools.macro "0.1.5"] [org.flatland/classlojure "0.7.1"] [org.slf4j/slf4j-nop "1.7.25"] [org.slf4j/slf4j-api "1.7.25"] [robert/hooke "1.3.0"] [net.cgrand/parsley "0.9.3" :exclusions [[org.clojure/clojure]]] [nrepl "1.0.0"] [org.clojars.trptcolin/sjacket "0.1.1.1" :exclusions [[org.clojure/clojure]]] [net.cgrand/regex "1.1.0"] [org.clojure/data.xml "0.2.0-alpha6"] [org.clojure/data.codec "0.1.0"] [org.nrepl/incomplete "0.1.0" :exclusions [[org.clojure/clojure]]] [scout "0.1.1"] [stencil "0.5.0" :exclusions [[org.clojure/core.cache]]] [quoin "0.1.2"] [timofreiberg/bultitude "0.3.0" :exclusions [[org.clojure/clojure] [org.tcrawley/dynapath]]] ```
lread commented 1 year ago

Testing against MrAnderson

Summary

Detected no problems, no changes seem to be required except the pomegranate bump.

How is MrAnderson tested on CI?

It uses CircleCI, we'll mimic what it does in our verification.

Setup

I'll use my fork of mranderson for testing. I'll run these tests from my host OS (which is Linux) using a babashka script. I tested under jdk17.

(require '[babashka.tasks :as t]
         '[babashka.fs :as fs]
         '[clojure.string :as string])

(defn del-tree [dir]
  (when (fs/exists? dir)
      (println "Deleting" (str dir))
      (fs/delete-tree dir)))

(defn wipe-artifacts [project]
  (let [m2-repo (fs/file (fs/home) ".m2" "repository" project)]
    (del-tree m2-repo)))

(defn clone [project]
  (let [dir (-> project
                (string/split #"/")
                last
                (str "-test"))]
    (println "Cloning" project "to dir" dir)
    (del-tree dir)
    (t/shell (str "git clone https://github.com/" project) dir)
    dir))

(defn switch-branch [dir branch]
  (t/shell {:dir dir} "git switch" branch)
  dir)

(defn git-diff [dir]
  (println "<- begin diff from master")
  (t/shell {:dir dir} "git diff master")
  (println ">- end diff from master")
  dir)

(defn deps-tree [dir]
  (t/shell {:dir dir} "lein deps :tree"))

(defn install-test-pomegranate []
  (let [dir (clone "clj-commons/pomegranate")]
    (t/shell {:dir dir} "bb install")))

(defn run-mranderson-tests
  "mimic what mranderson is running as tests on circleci"
  [dir]
  (let [opts {:dir dir}]
    (t/shell opts "lein test")
    (t/shell opts ".circleci/integration_test.sh")
    (t/shell opts "lein with-profile +eastwood eastwood")
    (t/shell opts "lein kaocha-coverage --codecov")
    dir))

(let [mranderson-branch (first *command-line-args*)]
  (or mranderson-branch (do (println "* must specify mranderson branch to test against")
                            (System/exit 1)))
  ;; make sure I'm not using local test versions of these libs
  (wipe-artifacts "clj-commons/pomegranate")
  (wipe-artifacts "thomasa/mranderson")
  (install-test-pomegranate)
  (-> (clone "lread/mranderson")
      (switch-branch mranderson-branch)
      (git-diff)
      (run-mranderson-tests)
      (deps-tree)))

Test run 1: sanity -run existing MrAnderson tests

bb test.clj master

Tests pass.

Test run 2: against new Pomegranate

This lread-test-pomegranate-fix1 branch ended up to only need to bump the pomegranate dep. https://github.com/lread/mranderson/compare/master...lread-test-pomegranate-fix1

bb test.clj lread-test-pomegranate-fix1

Tests pass.

lread commented 1 year ago

Testing MrAnderson usage in cider-nrepl

I took a more manual approach with this one.

MrAnderson uses pomegranate to resolve dependencies. I don't think I'm helping to verify Pomegranate by verifying MrAnderson inlined deps source code generation. I instead simply look at the deps tree MrAnderson dumps to the console when inlining deps for cider-nrepl.

I compared make inline-deps console stderr/stdout for cider-nrepl the following:

Scenario 1: current deps generation

  1. with current MrAnderson 0.5.4-SNAPSHOT release
  2. with MrAnderson HEAD and Pomegranate HEAD

Scenario 2: fudge cider-nrepl to have MrAnderson generate :unresolved-tree true deps

  1. with current MrAnderson 0.5.4-SNAPSHOT release
  2. with MrAnderson HEAD and Pomegranate HEAD

This all looks good. Dumped deps are unchanged with the new Pomegranate.

lread commented 1 year ago

I think we are good here. Leiningen will require one fix to its tests for that invalid :checksum value. It does expose/describe :checksum via its sample project.clj but only documents valid Pomegranate values.