-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reset deployment between tests
- Loading branch information
Showing
8 changed files
with
51 additions
and
6 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
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
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
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
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
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
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
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,34 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Spex.Verifier.Reseter where | ||
|
||
import System.Exit | ||
import System.Process | ||
|
||
import Spex.Monad | ||
import Spex.Syntax | ||
import Spex.Syntax.Operation | ||
import Spex.Syntax.Type | ||
import Spex.Syntax.Value | ||
import Spex.Verifier.HttpClient | ||
|
||
------------------------------------------------------------------------ | ||
|
||
reseter :: HttpClient -> Reset -> App () | ||
reseter client reset = do | ||
case reset of | ||
ResetPath path -> do | ||
let op = Op "_reset" Delete [Path path] Nothing UnitT | ||
debug (displayOp displayValue op) | ||
eResp <- tryA $ httpRequest client op | ||
case eResp of | ||
Left _err -> throwA ResetFailed | ||
Right (Ok2xx _body) -> return () | ||
Right ClientError4xx {} -> throwA ResetFailed | ||
Right ServerError5xx {} -> throwA ResetFailed | ||
|
||
ResetScript fp -> do | ||
(exitCode, _out, _err) <- liftIO (readProcessWithExitCode fp [] "") | ||
case exitCode of | ||
ExitSuccess -> return () | ||
ExitFailure _code -> throwA ResetFailed |