-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: lake: add manifest version upgrade test
- Loading branch information
Showing
8 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Lake | ||
open Lake DSL | ||
package bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rm -rf lakefile.olean foo/lakefile.olean bar/.git lake-packages lake-manifest.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Lake | ||
open Lake DSL | ||
package foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{"version": 5, | ||
"packagesDir": "lake-packages", | ||
"packages": | ||
[{"git": | ||
{"url": "bar", | ||
"subDir?": null, | ||
"rev": "253735aaee71d8bb0f29ae5cfc3ce086a4b9e64f", | ||
"opts": {}, | ||
"name": "bar", | ||
"inputRev?": null, | ||
"inherited": false}}, | ||
{"path": {"opts": {}, "name": "foo", "inherited": false, "dir": "./foo"}}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{"version": 6, | ||
"packagesDir": "lake-packages", | ||
"packages": | ||
[{"path": {"opts": {}, "name": "foo", "inherited": false, "dir": "./foo"}}, | ||
{"git": | ||
{"url": "bar", | ||
"subDir?": null, | ||
"rev": "dab525a78710d185f3d23622b143bdd837e44ab0", | ||
"opts": {}, | ||
"name": "bar", | ||
"inputRev?": null, | ||
"inherited": false}}], | ||
"name": "test"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{"version": 7, | ||
"packagesDir": "lake-packages", | ||
"packages": | ||
[{"type": "path", | ||
"name": "foo", | ||
"manifestFile": "lake-manifest.json", | ||
"inherited": false, | ||
"dir": "./foo", | ||
"configFile": "lakefile.lean"}, | ||
{"url": "bar", | ||
"type": "git", | ||
"subDir": null, | ||
"rev": "0538596b94a0510f55dc820cabd3bde41ad93c3e", | ||
"name": "bar", | ||
"manifestFile": "lake-manifest.json", | ||
"inputRev": null, | ||
"inherited": false, | ||
"configFile": "lakefile.lean"}], | ||
"name": "test"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Lake | ||
open Lake DSL | ||
|
||
package test | ||
|
||
require foo from "foo" | ||
require bar from git "bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
set -exo pipefail | ||
|
||
LAKE=${LAKE:-../../build/bin/lake} | ||
|
||
if [ "`uname`" = Darwin ]; then | ||
sed_i() { sed -i '' "$@"; } | ||
else | ||
sed_i() { sed -i "$@"; } | ||
fi | ||
|
||
./clean.sh | ||
|
||
# Since committing a Git repository to a Git repository is not well-supported, | ||
# We reinitialize the bar repository on each test. This requires updating the | ||
# locked manifest to the new hash to ensure things work properly. | ||
pushd bar | ||
git init | ||
git checkout -b master | ||
git config user.name test | ||
git config user.email [email protected] | ||
git add --all | ||
git commit -m "initial commit" | ||
REV=`git rev-parse HEAD` | ||
popd | ||
|
||
# --- | ||
# Test manifest properly upgrades from supported versions | ||
# --- | ||
|
||
# Test successful loading of a V5 manifest | ||
cp lake-manifest-v5.json lake-manifest.json | ||
sed_i "s/253735aaee71d8bb0f29ae5cfc3ce086a4b9e64f/$REV/g" lake-manifest.json | ||
$LAKE resolve-deps | ||
|
||
# Test update produces the expected V7 manifest | ||
$LAKE update | ||
sed_i "s/$REV/0538596b94a0510f55dc820cabd3bde41ad93c3e/g" lake-manifest.json | ||
sed_i 's/\\\\/\//g' lake-manifest.json # normalize Windows paths | ||
diff --strip-trailing-cr lake-manifest-v7.json lake-manifest.json | ||
|
||
# Test successful loading of a V6 manifest | ||
cp lake-manifest-v6.json lake-manifest.json | ||
sed_i "s/dab525a78710d185f3d23622b143bdd837e44ab0/$REV/g" lake-manifest.json | ||
$LAKE resolve-deps | ||
|
||
# Test update produces the expected V7 manifest | ||
$LAKE update | ||
sed_i "s/$REV/0538596b94a0510f55dc820cabd3bde41ad93c3e/g" lake-manifest.json | ||
sed_i 's/\\\\/\//g' lake-manifest.json # normalize Windows paths | ||
diff --strip-trailing-cr lake-manifest-v7.json lake-manifest.json |