Skip to content

Commit

Permalink
Fix: broken tests due to real-world changes
Browse files Browse the repository at this point in the history
The following tests were breaking before the changes in this commit:

```
FAIL in (latest-version-test) (dep_add_test.clj:9)
expected: (= "1.11.1" (neil/latest-stable-mvn-version (quote org.clojure/clojure)))
  actual: (not (= "1.11.1" "1.11.2"))

FAIL in (dep-upgrade-test-using-git-tags) (dep_upgrade_test.clj:71)
deps can be added with --tag
expected: (= "v2022.03.08" (:git/tag original))
  actual: (not (= "v2022.03.08" "v2024.03.13"))

FAIL in (dep-upgrade-test-using-git-tags) (dep_upgrade_test.clj:79)
deps with :git/tag coords upgrade to latest tags
expected: (= "v2022.03.08" (:git/tag original))
  actual: (not (= "v2022.03.08" "v2024.03.13"))

FAIL in (dep-upgrade-test-using-git-tags) (dep_upgrade_test.clj:84)
deps with :git/tag coords upgrade to latest tags
expected: (not= (:git/tag original) (:git/tag upgraded))
  actual: (not (not= "v2024.03.13" "v2024.03.13"))
```

The reasons for this are:

1. The latest stable version of `org.clojure/clojure` is `1.11.2`
2. Running `git/find-github-tag 'clj-kondo/clj-kondo "v2022.03.08"`
returns `nil`, which makes `neil` fetch the latest github tag instead.

To fix this, we:
1. Bump the latest stable version for Clojure in tests to 1.11.2
2. Bump the tag version used for `clj-kondo/clj-kondo` to
`v2024.03.13` (latest) in `dep add` tests.
3. Bump the tag version used for `clj-kondo/clj-kondo` to
`v2024.03.05` (not latest, but exists) in `dep upgrade` tests.
  • Loading branch information
vedang committed Mar 19, 2024
1 parent ad8b34e commit 8b993a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/babashka/neil/dep_add_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
(deftest latest-version-test
(is (= "1.0.5" (neil/latest-stable-clojars-version 'hiccup/hiccup)))
(is (= "2.0.0-RC3" (neil/latest-clojars-version 'hiccup/hiccup)))
(is (= "1.11.1" (neil/latest-stable-mvn-version 'org.clojure/clojure))))
(is (= "1.11.2" (neil/latest-stable-mvn-version 'org.clojure/clojure))))
12 changes: 6 additions & 6 deletions test/babashka/neil/dep_upgrade_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@

(testing "deps can be added with --tag"
(spit test-file-path "{}")
(test-util/neil "dep add :lib clj-kondo/clj-kondo :tag \"v2022.03.08\"" :deps-file test-file-path)
(test-util/neil "dep add :lib clj-kondo/clj-kondo :tag \"v2024.03.13\"" :deps-file test-file-path)
(let [original (get-dep-version 'clj-kondo/clj-kondo)]
(is (= "v2022.03.08" (:git/tag original)))
(is (= "v2024.03.13" (:git/tag original)))
(is (:git/sha original))
(is (:git/url original))))

(testing "deps with :git/tag coords upgrade to latest tags"
(spit test-file-path "{}")
(test-util/neil "dep add :lib clj-kondo/clj-kondo :tag \"v2022.03.08\"" :deps-file test-file-path)
(test-util/neil "dep add :lib clj-kondo/clj-kondo :tag \"v2024.03.05\"" :deps-file test-file-path)
(let [original (get-dep-version 'clj-kondo/clj-kondo)]
(is (= "v2022.03.08" (:git/tag original)))
(is (= "v2024.03.05" (:git/tag original)))
(test-util/neil "dep upgrade" :deps-file test-file-path)
(let [upgraded (get-dep-version 'clj-kondo/clj-kondo)]
(is (= (:git/url original) (:git/url upgraded)))
Expand All @@ -85,9 +85,9 @@
(is (:git/sha upgraded)))))

(testing "deps with :tag coords are also supported"
(spit test-file-path "{:deps {clj-kondo/clj-kondo {:tag \"v2022.03.08\" :sha \"247e538\"}}}")
(spit test-file-path "{:deps {clj-kondo/clj-kondo {:tag \"v2024.03.05\" :sha \"58ed56e\"}}}")
(let [original (get-dep-version 'clj-kondo/clj-kondo)]
(is (= "v2022.03.08" (:tag original)))
(is (= "v2024.03.05" (:tag original)))
(test-util/neil "dep upgrade" :deps-file test-file-path)
(let [upgraded (get-dep-version 'clj-kondo/clj-kondo)]
(is (:git/tag upgraded))
Expand Down

0 comments on commit 8b993a7

Please sign in to comment.