Skip to content

Commit

Permalink
reftests: add repository test
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Nov 25, 2021
1 parent eaa01ae commit c8f08d3
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/reftests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,23 @@
%{targets}
(run ./run.exe %{bin:opam} %{dep:pat-sub.test} %{read-lines:testing-env}))))

(rule
(alias reftest-repository)
(action
(diff repository.test repository.out)))

(alias
(name reftest)
(deps (alias reftest-repository)))

(rule
(targets repository.out)
(deps root-N0REP0)
(action
(with-stdout-to
%{targets}
(run ./run.exe %{bin:opam} %{dep:repository.test} %{read-lines:testing-env}))))

(rule
(alias reftest-show)
(action
Expand Down
93 changes: 93 additions & 0 deletions tests/reftests/repository.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
N0REP0
### <pkg:first.1>
opam-version: "2.0"
### <REPO2/repo>
opam-version: "2.0"
### <REPO2/packages/second/second.2/opam>
opam-version: "2.0"
### <REPO3/repo>
opam-version: "2.0"
### <REPO3/packages/third/third.3/opam>
opam-version: "2.0"
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam switch create repos --empty
### opam list --all --short
first
### : repo addition
### opam repository add repo2 ./REPO2
[repo2] Initialised
[NOTE] Repository repo2 has been added to the selections of switch repos only.
Run `opam repository add repo2 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.

### opam list --all --short
first
second
### : repo addition with no action
### opam repository add repo3 ./REPO3 --no-action
[NOTE] Repository repo3 has been added to the selections of switch repos only.
Run `opam repository add repo3 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.

### opam list --all --short
first
second
### opam update repo3

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[repo3] Initialised
Now run 'opam upgrade' to apply any package updates.
### opam list --all --short
first
second
third
### : repo set-url
### opam repository remove repo3
Repositories removed from the selections of switch repos. Use '--all' to forget about them altogether.
### opam repository set-url repo2 ./REPO3
[repo2] Initialised
### opam list --all --short
first
third
### : repo set-url with no-action
### opam repository set-url repo2 ./REPO2 --no-action
### opam list --all --short
first
### opam update repo2

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[repo2] Initialised
Now run 'opam upgrade' to apply any package updates.
### opam list --all --short
first
second
### : add with wrong url
### opam repository add repo4 ./REPO4
[ERROR] Could not update repository "repo4": rsync failed
[ERROR] Initial repository fetch failed
# Return code 40 #
### opam repository add repo4 ./REPO4 --no-action
[NOTE] Repository repo4 has been added to the selections of switch repos only.
Run `opam repository add repo4 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.

### opam list --all --short
first
second
### opam update repo4

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Could not update repository "repo4": rsync failed
# Return code 40 #
### : set-url with wrong url
### opam repository set-url default ./REPO4
[ERROR] Could not update repository "default": rsync failed
### opam repository set-url default ./REPO4 --no-action
### opam list --all --short
second
### opam update default

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Could not update repository "default": rsync failed
# Return code 40 #

0 comments on commit c8f08d3

Please sign in to comment.