Skip to content

Commit

Permalink
Skip non-terminating tests in Windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Aug 26, 2024
1 parent 6095f64 commit 66beb26
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Test.Cabal.Prelude
import Data.List (isPrefixOf)

main = cabalTest $ flakyIfCI 9530 $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do
main = skipIfCIAndWindows 10230 >> (cabalTest $ flakyIfCI 9530 $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do

Check warning on line 4 in cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.test.hs

View workflow job for this annotation

GitHub Actions / hlint

Suggestion in main in module Main: Move brackets to avoid $ ▫︎ Found: "skipIfCIAndWindows 10230\n >>\n (cabalTest\n $ flakyIfCI 9530\n $ withProjectFile \"cabal.project\"\n $ withRemoteRepo \"repo\"\n $ do output <- last\n . words\n . head\n . filter\n (\"Index cache updated to index-state \" `isPrefixOf`)\n . lines . resultOutput\n <$> recordMode DoNotRecord (cabal' \"update\" [])\n shell \"cp\" [\"cabal.out.in\", \"cabal.out\"]\n shell\n \"sed\"\n [\"-i\" ++ if not isWindows then \"''\" else \"\", \"-e\",\n \"s/REPLACEME/\" <> output <> \"/g\", \"cabal.out\"]\n fails\n $ cabal \"build\" [\"--index-state=4000-01-01T00:00:00Z\", \"fake-pkg\"]\n fails\n $ cabal \"build\" [\"--index-state=2023-01-01T00:00:00Z\", \"fake-pkg\"])" ▫︎ Perhaps: "skipIfCIAndWindows 10230\n >>\n cabalTest\n (flakyIfCI 9530\n $ withProjectFile \"cabal.project\"\n $ withRemoteRepo \"repo\"\n $ do output <- last\n . words\n . head\n . filter\n (\"Index cache updated to index-state \" `isPrefixOf`)\n . lines . resultOutput\n <$> recordMode DoNotRecord (cabal' \"update\" [])\n shell \"cp\" [\"cabal.out.in\", \"cabal.out\"]\n shell\n \"sed\"\n [\"-i\" ++ if not isWindows then \"''\" else \"\", \"-e\",\n \"s/REPLACEME/\" <> output <> \"/g\", \"cabal.out\"]\n fails\n $ cabal \"build\" [\"--index-state=4000-01-01T00:00:00Z\", \"fake-pkg\"]\n fails\n $ 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"]
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"])
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Test.Cabal.Prelude

main = cabalTest $ flakyIfCI 9530 $ withRemoteRepo "repo" $ do
main = skipIfCIAndWindows 10230 >> (cabalTest $ flakyIfCI 9530 $ withRemoteRepo "repo" $ do

Check warning on line 3 in cabal-testsuite/PackageTests/NewUpdate/UpdateIndexState/update-index-state.test.hs

View workflow job for this annotation

GitHub Actions / hlint

Suggestion in main in module Main: Move brackets to avoid $ ▫︎ Found: "skipIfCIAndWindows 10230\n >>\n (cabalTest\n $ flakyIfCI 9530\n $ withRemoteRepo \"repo\"\n $ do res <- recordMode DoNotRecord\n $ cabal' \"update\" [\"repository.localhost,2022-01-28T02:36:41Z\"]\n assertOutputContains\n \"The index-state is set to 2022-01-28T02:36:41Z\" res\n assertOutputDoesNotContain \"revert\" res\n cabal \"update\" [\"repository.localhost,2016-09-24T17:47:48Z\"]\n cabal \"update\" [\"repository.localhost,2022-01-28T02:36:41Z\"])" ▫︎ Perhaps: "skipIfCIAndWindows 10230\n >>\n cabalTest\n (flakyIfCI 9530\n $ withRemoteRepo \"repo\"\n $ do res <- recordMode DoNotRecord\n $ cabal' \"update\" [\"repository.localhost,2022-01-28T02:36:41Z\"]\n assertOutputContains\n \"The index-state is set to 2022-01-28T02:36:41Z\" res\n assertOutputDoesNotContain \"revert\" res\n cabal \"update\" [\"repository.localhost,2016-09-24T17:47:48Z\"]\n cabal \"update\" [\"repository.localhost,2022-01-28T02:36:41Z\"])"

-- 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"]
-- 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"])

0 comments on commit 66beb26

Please sign in to comment.