-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
39 deletions.
There are no files selected for viewing
38 changes: 16 additions & 22 deletions
38
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.test.hs
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 |
---|---|---|
@@ -1,26 +1,20 @@ | ||
import Test.Cabal.Prelude | ||
import Data.List (isPrefixOf) | ||
|
||
main = cabalTest $ do | ||
main = cabalTest $ flakyIfCI 9530 $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do | ||
|
||
skip "Flaky test failing in `curl`, see #9530" | ||
|
||
testBody | ||
|
||
testBody = withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do | ||
|
||
output <- last | ||
. words | ||
. head | ||
. filter ("Index cache updated to index-state " `isPrefixOf`) | ||
. lines | ||
. resultOutput | ||
<$> recordMode DoNotRecord (cabal' "update" []) | ||
-- update golden output with actual timestamp | ||
shell "cp" ["cabal.out.in", "cabal.out"] | ||
shell "sed" ["-i''", "-e", "s/REPLACEME/" <> output <> "/g", "cabal.out"] | ||
-- This shall fail with an error message as specified in `cabal.out` | ||
fails $ cabal "build" ["--index-state=4000-01-01T00:00:00Z", "fake-pkg"] | ||
-- This shall fail by not finding the package, what indicates that it | ||
-- accepted an older index-state. | ||
fails $ cabal "build" ["--index-state=2023-01-01T00:00:00Z", "fake-pkg"] | ||
output <- last | ||
. words | ||
. head | ||
. filter ("Index cache updated to index-state " `isPrefixOf`) | ||
. lines | ||
. resultOutput | ||
<$> recordMode DoNotRecord (cabal' "update" []) | ||
-- update golden output with actual timestamp | ||
shell "cp" ["cabal.out.in", "cabal.out"] | ||
shell "sed" [ "-i" ++ if not isWindows then "''" else "", "-e", "s/REPLACEME/" <> output <> "/g", "cabal.out"] | ||
-- This shall fail with an error message as specified in `cabal.out` | ||
fails $ cabal "build" ["--index-state=4000-01-01T00:00:00Z", "fake-pkg"] | ||
-- This shall fail by not finding the package, what indicates that it | ||
-- accepted an older index-state. | ||
fails $ cabal "build" ["--index-state=2023-01-01T00:00:00Z", "fake-pkg"] |
28 changes: 11 additions & 17 deletions
28
cabal-testsuite/PackageTests/NewUpdate/UpdateIndexState/update-index-state.test.hs
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 |
---|---|---|
@@ -1,19 +1,13 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest $ do | ||
|
||
skip "Flaky test failing in `curl`, see #9530" | ||
|
||
testBody | ||
|
||
testBody = withRemoteRepo "repo" $ do | ||
|
||
-- The _first_ update call causes a warning about missing mirrors, the warning | ||
-- is platform-dependent and it's not part of the test expectations, so we | ||
-- check the output manually. | ||
res <- recordMode DoNotRecord $ | ||
cabal' "update" ["repository.localhost,2022-01-28T02:36:41Z"] | ||
assertOutputContains "The index-state is set to 2022-01-28T02:36:41Z" res | ||
assertOutputDoesNotContain "revert" res | ||
cabal "update" ["repository.localhost,2016-09-24T17:47:48Z"] | ||
cabal "update" ["repository.localhost,2022-01-28T02:36:41Z"] | ||
main = cabalTest $ flakyIfCI 9530 $ withRemoteRepo "repo" $ do | ||
|
||
-- The _first_ update call causes a warning about missing mirrors, the warning | ||
-- is platform-dependent and it's not part of the test expectations, so we | ||
-- check the output manually. | ||
res <- recordMode DoNotRecord $ | ||
cabal' "update" ["repository.localhost,2022-01-28T02:36:41Z"] | ||
assertOutputContains "The index-state is set to 2022-01-28T02:36:41Z" res | ||
assertOutputDoesNotContain "revert" res | ||
cabal "update" ["repository.localhost,2016-09-24T17:47:48Z"] | ||
cabal "update" ["repository.localhost,2022-01-28T02:36:41Z"] |