From 3a05cd144dae9c1b30c00d30c8b6703b778d65cf Mon Sep 17 00:00:00 2001 From: Alex Biehl Date: Tue, 6 Feb 2024 09:17:02 +0100 Subject: [PATCH] Switch test-suite to use pretty-show and yaml for the output capture for easier diffs --- scarf-gateway.cabal | 1 + src/Scarf/Gateway/Rule.hs | 4 +- src/Scarf/Gateway/Rule/Capture.hs | 5 +- src/Scarf/Lib/Tracing.hs | 6 +- test/Scarf/Gateway/Golden.hs | 82 ++++++++----------- test/golden/auto-creation-rules-1.output.json | 8 -- test/golden/auto-creation-rules-1.output.yaml | 13 +++ test/golden/auto-creation-rules-2.output.body | 0 test/golden/auto-creation-rules-2.output.yaml | 14 ++++ test/golden/auto-creation-rules-2.yaml | 15 ++++ test/golden/docker-test-1.output.json | 8 -- test/golden/docker-test-1.output.yaml | 14 ++++ ...-variables-and-no-outgoing-url.output.json | 5 -- ...-variables-and-no-outgoing-url.output.yaml | 11 +++ ...h-no-outgoing-url-and-no-match.output.json | 5 -- ...h-no-outgoing-url-and-no-match.output.yaml | 3 + ...rl-with-variables-and-no-match.output.json | 5 -- ...rl-with-variables-and-no-match.output.yaml | 3 + ...e-package-with-no-outgoing-url.output.json | 5 -- ...e-package-with-no-outgoing-url.output.yaml | 9 ++ .../file-package-with-variables-1.output.json | 8 -- .../file-package-with-variables-1.output.yaml | 15 ++++ .../file-package-with-variables-2.output.json | 8 -- .../file-package-with-variables-2.output.yaml | 15 ++++ .../file-package-with-variables-3.output.json | 6 -- .../file-package-with-variables-3.output.yaml | 4 + .../file-package-with-variables-4.output.json | 7 -- .../file-package-with-variables-4.output.yaml | 10 +++ ...-variables-and-no-outgoing-url.output.json | 5 -- ...-variables-and-no-outgoing-url.output.yaml | 9 ++ ...ile-package-without-variable-2.output.json | 8 -- ...ile-package-without-variable-2.output.yaml | 11 +++ .../file-package-without-variable.output.json | 8 -- .../file-package-without-variable.output.yaml | 11 +++ ...file-package-without-varible-1.output.json | 8 -- ...file-package-without-varible-1.output.yaml | 13 +++ ...file-package-without-varible-2.output.json | 8 -- ...file-package-without-varible-2.output.yaml | 13 +++ ...file-package-without-varible-3.output.json | 7 -- ...file-package-without-varible-3.output.yaml | 12 +++ ...file-package-without-varible-4.output.json | 7 -- ...file-package-without-varible-4.output.yaml | 10 +++ test/golden/issue-2535-1.output.json | 7 -- test/golden/issue-2535-1.output.yaml | 10 +++ test/golden/issue-2535-2.output.json | 8 -- test/golden/issue-2535-2.output.yaml | 14 ++++ test/golden/pixel.output.json | 10 --- test/golden/pixel.output.yaml | 7 ++ test/golden/python-test-caching.output.json | 7 -- test/golden/python-test-caching.output.yaml | 11 +++ test/golden/python-test-file.output.json | 7 -- test/golden/python-test-file.output.yaml | 13 +++ test/golden/python-test-hash.output.json | 9 -- test/golden/python-test-hash.output.yaml | 13 +++ .../python-test-non-existing-file.output.json | 5 -- .../python-test-non-existing-file.output.yaml | 3 + .../python-test-package-head.output.json | 9 -- .../python-test-package-head.output.yaml | 13 +++ test/golden/python-test-package.output.json | 9 -- test/golden/python-test-package.output.yaml | 13 +++ test/golden/python-test-root-head.output.json | 9 -- test/golden/python-test-root-head.output.yaml | 13 +++ test/golden/python-test-root.output.json | 9 -- test/golden/python-test-root.output.yaml | 13 +++ .../golden/re-file-package-test-1.output.json | 7 -- .../golden/re-file-package-test-1.output.yaml | 10 +++ .../golden/re-file-package-test-2.output.json | 7 -- .../golden/re-file-package-test-2.output.yaml | 15 ++++ test/golden/scarfjs-1.output.json | 7 -- test/golden/scarfjs-1.output.yaml | 16 ++++ 70 files changed, 414 insertions(+), 279 deletions(-) delete mode 100644 test/golden/auto-creation-rules-1.output.json create mode 100644 test/golden/auto-creation-rules-1.output.yaml create mode 100644 test/golden/auto-creation-rules-2.output.body create mode 100644 test/golden/auto-creation-rules-2.output.yaml create mode 100644 test/golden/auto-creation-rules-2.yaml delete mode 100644 test/golden/docker-test-1.output.json create mode 100644 test/golden/docker-test-1.output.yaml delete mode 100644 test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.json create mode 100644 test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.yaml delete mode 100644 test/golden/file-package-with-no-outgoing-url-and-no-match.output.json create mode 100644 test/golden/file-package-with-no-outgoing-url-and-no-match.output.yaml delete mode 100644 test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.json create mode 100644 test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.yaml delete mode 100644 test/golden/file-package-with-no-outgoing-url.output.json create mode 100644 test/golden/file-package-with-no-outgoing-url.output.yaml delete mode 100644 test/golden/file-package-with-variables-1.output.json create mode 100644 test/golden/file-package-with-variables-1.output.yaml delete mode 100644 test/golden/file-package-with-variables-2.output.json create mode 100644 test/golden/file-package-with-variables-2.output.yaml delete mode 100644 test/golden/file-package-with-variables-3.output.json create mode 100644 test/golden/file-package-with-variables-3.output.yaml delete mode 100644 test/golden/file-package-with-variables-4.output.json create mode 100644 test/golden/file-package-with-variables-4.output.yaml delete mode 100644 test/golden/file-package-with-variables-and-no-outgoing-url.output.json create mode 100644 test/golden/file-package-with-variables-and-no-outgoing-url.output.yaml delete mode 100644 test/golden/file-package-without-variable-2.output.json create mode 100644 test/golden/file-package-without-variable-2.output.yaml delete mode 100644 test/golden/file-package-without-variable.output.json create mode 100644 test/golden/file-package-without-variable.output.yaml delete mode 100644 test/golden/file-package-without-varible-1.output.json create mode 100644 test/golden/file-package-without-varible-1.output.yaml delete mode 100644 test/golden/file-package-without-varible-2.output.json create mode 100644 test/golden/file-package-without-varible-2.output.yaml delete mode 100644 test/golden/file-package-without-varible-3.output.json create mode 100644 test/golden/file-package-without-varible-3.output.yaml delete mode 100644 test/golden/file-package-without-varible-4.output.json create mode 100644 test/golden/file-package-without-varible-4.output.yaml delete mode 100644 test/golden/issue-2535-1.output.json create mode 100644 test/golden/issue-2535-1.output.yaml delete mode 100644 test/golden/issue-2535-2.output.json create mode 100644 test/golden/issue-2535-2.output.yaml delete mode 100644 test/golden/pixel.output.json create mode 100644 test/golden/pixel.output.yaml delete mode 100644 test/golden/python-test-caching.output.json create mode 100644 test/golden/python-test-caching.output.yaml delete mode 100644 test/golden/python-test-file.output.json create mode 100644 test/golden/python-test-file.output.yaml delete mode 100644 test/golden/python-test-hash.output.json create mode 100644 test/golden/python-test-hash.output.yaml delete mode 100644 test/golden/python-test-non-existing-file.output.json create mode 100644 test/golden/python-test-non-existing-file.output.yaml delete mode 100644 test/golden/python-test-package-head.output.json create mode 100644 test/golden/python-test-package-head.output.yaml delete mode 100644 test/golden/python-test-package.output.json create mode 100644 test/golden/python-test-package.output.yaml delete mode 100644 test/golden/python-test-root-head.output.json create mode 100644 test/golden/python-test-root-head.output.yaml delete mode 100644 test/golden/python-test-root.output.json create mode 100644 test/golden/python-test-root.output.yaml delete mode 100644 test/golden/re-file-package-test-1.output.json create mode 100644 test/golden/re-file-package-test-1.output.yaml delete mode 100644 test/golden/re-file-package-test-2.output.json create mode 100644 test/golden/re-file-package-test-2.output.yaml delete mode 100644 test/golden/scarfjs-1.output.json create mode 100644 test/golden/scarfjs-1.output.yaml diff --git a/scarf-gateway.cabal b/scarf-gateway.cabal index 001f51d..4e4d6c3 100644 --- a/scarf-gateway.cabal +++ b/scarf-gateway.cabal @@ -207,6 +207,7 @@ test-suite scarf-gateway-test , internal , manifest , network-uri + , pretty-show , scarf-gateway , tasty , tasty-golden diff --git a/src/Scarf/Gateway/Rule.hs b/src/Scarf/Gateway/Rule.hs index ccac630..16483d4 100644 --- a/src/Scarf/Gateway/Rule.hs +++ b/src/Scarf/Gateway/Rule.hs @@ -237,10 +237,10 @@ data RedirectOrProxy | -- | Respond with bytes directly. RespondBytes !RuleCapture + -- | Headers we might want sent back !ResponseHeaders - -- ^ Headers we might want sent back + -- | Response body !LBS.ByteString - -- ^ Response body | -- | Respond OK with no data RespondOk !RuleCapture diff --git a/src/Scarf/Gateway/Rule/Capture.hs b/src/Scarf/Gateway/Rule/Capture.hs index a570920..ebb5b37 100644 --- a/src/Scarf/Gateway/Rule/Capture.hs +++ b/src/Scarf/Gateway/Rule/Capture.hs @@ -14,7 +14,6 @@ import Data.Aeson (Value) import Data.ByteString (ByteString) import Data.HashMap.Strict (HashMap) import Data.Text (Text) -import Data.Text qualified as Text import Data.Time (UTCTime) import Data.UUID (UUID) import Data.UUID.V4 qualified as UUID @@ -78,7 +77,7 @@ newRequestId = RequestId <$> UUID.nextRandom -- scarf-server. -- -- TODO Switch to e.g. thrift encoding using Schema -newtype CapturedRequest = CapturedRequest Text +newtype CapturedRequest = CapturedRequest (Maybe RuleCapture) deriving newtype (Show) -- | Captures all the relevant information for further processing. @@ -102,4 +101,4 @@ captureRequest :: Maybe RuleCapture -> CapturedRequest captureRequest _time _requestId _request _responseStatus mcapture = - CapturedRequest $ Text.pack $ maybe "" show mcapture + CapturedRequest $ mcapture diff --git a/src/Scarf/Lib/Tracing.hs b/src/Scarf/Lib/Tracing.hs index 7e5ae13..7263706 100644 --- a/src/Scarf/Lib/Tracing.hs +++ b/src/Scarf/Lib/Tracing.hs @@ -183,7 +183,8 @@ withRootTracer manager msamplingRate action = do not (null pushEndpoint) = do let options = zipkinOptions manager endpoint - & zoEndpoint .~ pushEndpoint + & zoEndpoint + .~ pushEndpoint close zipkin = closeZipkin zipkin `catch` \(_ :: BlockedIndefinitelyOnSTM) -> @@ -207,7 +208,8 @@ withRootTracer manager msamplingRate action = do Just port <- readMaybe (unpack port') = do let options = jaegerAgentOptions serviceName - & jaoAddr .~ UDPAddr (unpack hostname) port + & jaoAddr + .~ UDPAddr (unpack hostname) port withJaegerAgent options $ \agent -> do let batchOpts = batchOptions (traverse_ (jaegerAgentReporter agent)) diff --git a/test/Scarf/Gateway/Golden.hs b/test/Scarf/Gateway/Golden.hs index 80da63e..4861f22 100644 --- a/test/Scarf/Gateway/Golden.hs +++ b/test/Scarf/Gateway/Golden.hs @@ -11,8 +11,6 @@ import Data.Aeson ( FromJSON (..), ToJSON (..), Value (Null), - decode, - encode, object, withObject, (.!=), @@ -20,20 +18,17 @@ import Data.Aeson (.:?), (.=), ) -import Data.Aeson.Encode.Pretty (confCompare, defConfig, encodePretty') -import Data.Aeson.Encoding (dict, int, pair, pairs, text, unsafeToEncoding) import Data.Bifunctor (Bifunctor (bimap), first) import Data.ByteString qualified as ByteString -import Data.ByteString.Builder (stringUtf8) +import Data.ByteString.Lazy qualified import Data.CaseInsensitive qualified as CaseInsensitive import Data.HashMap.Strict qualified as HashMap import Data.IORef (newIORef, readIORef, writeIORef) import Data.List (sort) import Data.Map.Strict qualified as Map -import Data.Maybe (fromMaybe) import Data.Text (Text) import Data.Text.Encoding (decodeUtf8, encodeUtf8) -import Data.Yaml (decodeFileThrow) +import Data.Yaml (decodeFileThrow, encode) import Network.Wai ( Request ( rawQueryString, @@ -75,10 +70,11 @@ import Scarf.Gateway.Rule.Capture ) import Scarf.Lib.Tracing (nullTracer) import Scarf.Manifest (Manifest, manifestToRules) -import System.FilePath (replaceExtension) +import System.FilePath (replaceExtension, takeExtensions) import System.IO.Unsafe (unsafeInterleaveIO) import Test.Tasty (TestTree) import Test.Tasty.Golden (findByExtension, goldenVsStringDiff) +import Text.Show.Pretty qualified -- | Input values for Golden tests. data Input = Input @@ -141,7 +137,15 @@ test_gateway_golden = goldenTests "test/golden" goldenTests :: FilePath -> IO [TestTree] goldenTests testsDirectory = do - inputFiles <- findByExtension [".yaml"] testsDirectory + inputFiles' <- findByExtension [".yaml"] testsDirectory + + -- The glob above also includes the .output.yaml files. Ensure + -- we only take the input files. + let inputFiles = + filter + (\file -> takeExtensions file == ".yaml") + inputFiles' + when (null inputFiles) $ error "No golden tests!" flip foldMap inputFiles $ \inputFile -> do @@ -198,24 +202,19 @@ goldenTests testsDirectory = do } (request, capture) <- takeMVar chan - -- We want to have clear and deterministic diffs. For that we have to run the produced - -- JSON through aeson-pretty. - let json :: Value - json = - fromMaybe (error "impossible") $ - decode $ - encode $ - Output - { outputQueryString = - decodeUtf8 (rawQueryString request), - outputStatus = - fromEnum simpleStatus, - outputHeaders = - fmap (bimap (decodeUtf8 . CaseInsensitive.original) decodeUtf8) simpleHeaders, - outputCapture = - capture - } - pure (encodePretty' (defConfig {confCompare = compare}) json, simpleBody) + let output = + Output + { outputQueryString = + decodeUtf8 (rawQueryString request), + outputStatus = + fromEnum simpleStatus, + outputHeaders = + fmap (bimap (decodeUtf8 . CaseInsensitive.original) decodeUtf8) simpleHeaders, + outputCapture = + capture + } + + pure (Data.ByteString.Lazy.fromStrict (Data.Yaml.encode output), simpleBody) let compareFiles = \ref new -> ["diff", "-u", ref, new] @@ -223,7 +222,7 @@ goldenTests testsDirectory = do [ goldenVsStringDiff inputFile compareFiles - (replaceExtension inputFile "output.json") + (replaceExtension inputFile "output.yaml") (pure (fst testResult)), goldenVsStringDiff (inputFile <> " body") @@ -256,21 +255,12 @@ instance FromJSON Input where <*> o .: "manifest" instance ToJSON Output where - toJSON = - error "Unimplemented due to CapturedRequest not having a ToJSON instance for performance reasons" - - toEncoding Output {..} = - pairs $ - pair "status" (int outputStatus) - <> pair - "headers" - (dict text text Map.foldrWithKey (Map.fromList outputHeaders)) - <> pair - "capture" - ( unsafeToEncoding - ( stringUtf8 $ show outputCapture - ) - ) - <> if outputQueryString /= "" - then pair "query" (text outputQueryString) - else mempty + toJSON Output {..} = + object $ + [ "status" .= outputStatus, + "headers" .= Map.fromList outputHeaders, + "capture" .= Text.Show.Pretty.ppShow outputCapture + ] + <> [ "query" .= outputQueryString + | outputQueryString /= "" + ] diff --git a/test/golden/auto-creation-rules-1.output.json b/test/golden/auto-creation-rules-1.output.json deleted file mode 100644 index 7ec56b8..0000000 --- a/test/golden/auto-creation-rules-1.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "DockerCapture {dockerCaptureImage = [\"library\",\"proxy\"], dockerCaptureReference = \"latest\", dockerCaptureBackendRegistry = \"ghcr.io\", dockerCapturePackage = Nothing, dockerCaptureAutoCreate = Just \"rule-123\"}", - "headers": { - "Location": "https://ghcr.io/v2/library/proxy/manifests/latest", - "X-This-Request-Was-Proxied": "1" - }, - "status": 307 -} \ No newline at end of file diff --git a/test/golden/auto-creation-rules-1.output.yaml b/test/golden/auto-creation-rules-1.output.yaml new file mode 100644 index 0000000..5fadd9f --- /dev/null +++ b/test/golden/auto-creation-rules-1.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + DockerCapture + { dockerCaptureImage = [ "library" , "proxy" ] + , dockerCaptureReference = "latest" + , dockerCaptureBackendRegistry = "ghcr.io" + , dockerCapturePackage = Nothing + , dockerCaptureAutoCreate = Just "rule-123" + } +headers: + Location: https://ghcr.io/v2/library/proxy/manifests/latest + X-This-Request-Was-Proxied: '1' +status: 307 diff --git a/test/golden/auto-creation-rules-2.output.body b/test/golden/auto-creation-rules-2.output.body new file mode 100644 index 0000000..e69de29 diff --git a/test/golden/auto-creation-rules-2.output.yaml b/test/golden/auto-creation-rules-2.output.yaml new file mode 100644 index 0000000..1a55eb8 --- /dev/null +++ b/test/golden/auto-creation-rules-2.output.yaml @@ -0,0 +1,14 @@ +capture: |- + Just + DockerCapture + { dockerCaptureImage = [ "library" , "hello-world" ] + , dockerCaptureReference = "latest" + , dockerCaptureBackendRegistry = "ghcr.io" + , dockerCapturePackage = + Just "8717953c-3452-4ef7-9a14-b64dc19163b4" + , dockerCaptureAutoCreate = Nothing + } +headers: + Location: https://ghcr.io/v2/library/hello-world/manifests/latest + X-This-Request-Was-Proxied: '1' +status: 307 diff --git a/test/golden/auto-creation-rules-2.yaml b/test/golden/auto-creation-rules-2.yaml new file mode 100644 index 0000000..dd8aa91 --- /dev/null +++ b/test/golden/auto-creation-rules-2.yaml @@ -0,0 +1,15 @@ +path: /v2/library/hello-world/manifests/latest +headers: + Host: cr.test.io +manifest: + rules: + - type: docker-v1 + repository-name: library/hello-world + domain: cr.test.io + registry: ghcr.io + package-id: "8717953c-3452-4ef7-9a14-b64dc19163b4" + - type: docker-v2 + domain: cr.test.io + registry: ghcr.io + rule-id: rule-123 + pattern: "library/hello-world" diff --git a/test/golden/docker-test-1.output.json b/test/golden/docker-test-1.output.json deleted file mode 100644 index c32dd47..0000000 --- a/test/golden/docker-test-1.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "DockerCapture {dockerCaptureImage = [\"library\",\"proxy\"], dockerCaptureReference = \"latest\", dockerCaptureBackendRegistry = \"ghcr.io\", dockerCapturePackage = Just \"8717953c-3452-4ef7-9a14-b64dc19163b4\", dockerCaptureAutoCreate = Nothing}", - "headers": { - "Location": "https://ghcr.io/v2/library/proxy/manifests/latest", - "X-This-Request-Was-Proxied": "1" - }, - "status": 307 -} \ No newline at end of file diff --git a/test/golden/docker-test-1.output.yaml b/test/golden/docker-test-1.output.yaml new file mode 100644 index 0000000..14daaaa --- /dev/null +++ b/test/golden/docker-test-1.output.yaml @@ -0,0 +1,14 @@ +capture: |- + Just + DockerCapture + { dockerCaptureImage = [ "library" , "proxy" ] + , dockerCaptureReference = "latest" + , dockerCaptureBackendRegistry = "ghcr.io" + , dockerCapturePackage = + Just "8717953c-3452-4ef7-9a14-b64dc19163b4" + , dockerCaptureAutoCreate = Nothing + } +headers: + Location: https://ghcr.io/v2/library/proxy/manifests/latest + X-This-Request-Was-Proxied: '1' +status: 307 diff --git a/test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.json b/test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.json deleted file mode 100644 index be11e13..0000000 --- a/test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Nothing, fileVariables = fromList [(\"somevar\",\"very-nice\"),(\"somevar2\",\"really-nice\")], filePackage = \"21c24cd1-73fa-4970-8a6a-bc570e55b91e\"}", - "headers": {}, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.yaml b/test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.yaml new file mode 100644 index 0000000..c257a11 --- /dev/null +++ b/test/golden/file-package-with-multiple-variables-and-no-outgoing-url.output.yaml @@ -0,0 +1,11 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Nothing + , fileVariables = + fromList + [ ( "somevar" , "very-nice" ) , ( "somevar2" , "really-nice" ) ] + , filePackage = "21c24cd1-73fa-4970-8a6a-bc570e55b91e" + } +headers: {} +status: 200 diff --git a/test/golden/file-package-with-no-outgoing-url-and-no-match.output.json b/test/golden/file-package-with-no-outgoing-url-and-no-match.output.json deleted file mode 100644 index f58c06e..0000000 --- a/test/golden/file-package-with-no-outgoing-url-and-no-match.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "capture": "", - "headers": {}, - "status": 404 -} \ No newline at end of file diff --git a/test/golden/file-package-with-no-outgoing-url-and-no-match.output.yaml b/test/golden/file-package-with-no-outgoing-url-and-no-match.output.yaml new file mode 100644 index 0000000..6b659a3 --- /dev/null +++ b/test/golden/file-package-with-no-outgoing-url-and-no-match.output.yaml @@ -0,0 +1,3 @@ +capture: Nothing +headers: {} +status: 404 diff --git a/test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.json b/test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.json deleted file mode 100644 index f58c06e..0000000 --- a/test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "capture": "", - "headers": {}, - "status": 404 -} \ No newline at end of file diff --git a/test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.yaml b/test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.yaml new file mode 100644 index 0000000..6b659a3 --- /dev/null +++ b/test/golden/file-package-with-no-outgoing-url-with-variables-and-no-match.output.yaml @@ -0,0 +1,3 @@ +capture: Nothing +headers: {} +status: 404 diff --git a/test/golden/file-package-with-no-outgoing-url.output.json b/test/golden/file-package-with-no-outgoing-url.output.json deleted file mode 100644 index fa9dfc1..0000000 --- a/test/golden/file-package-with-no-outgoing-url.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Nothing, fileVariables = fromList [], filePackage = \"a3941b62-12ff-4c39-a263-4342495f4b8b\"}", - "headers": {}, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/file-package-with-no-outgoing-url.output.yaml b/test/golden/file-package-with-no-outgoing-url.output.yaml new file mode 100644 index 0000000..b3499ea --- /dev/null +++ b/test/golden/file-package-with-no-outgoing-url.output.yaml @@ -0,0 +1,9 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Nothing + , fileVariables = fromList [] + , filePackage = "a3941b62-12ff-4c39-a263-4342495f4b8b" + } +headers: {} +status: 200 diff --git a/test/golden/file-package-with-variables-1.output.json b/test/golden/file-package-with-variables-1.output.json deleted file mode 100644 index 9b162f4..0000000 --- a/test/golden/file-package-with-variables-1.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data?drilldowns=Nation&measures=Population\", fileVariables = fromList [(\"drilldowns\",\"Nation\"),(\"measures\",\"Population\")], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data?drilldowns=Nation&measures=Population" - }, - "query": "?drilldowns=Nation&measures=Population", - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-with-variables-1.output.yaml b/test/golden/file-package-with-variables-1.output.yaml new file mode 100644 index 0000000..9a7057b --- /dev/null +++ b/test/golden/file-package-with-variables-1.output.yaml @@ -0,0 +1,15 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = + Just + "https://datausa.io/api/data?drilldowns=Nation&measures=Population" + , fileVariables = + fromList + [ ( "drilldowns" , "Nation" ) , ( "measures" , "Population" ) ] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data?drilldowns=Nation&measures=Population +query: ?drilldowns=Nation&measures=Population +status: 302 diff --git a/test/golden/file-package-with-variables-2.output.json b/test/golden/file-package-with-variables-2.output.json deleted file mode 100644 index dd02b67..0000000 --- a/test/golden/file-package-with-variables-2.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data?drilldowns=Nation&measures=Population\", fileVariables = fromList [(\"drilldowns\",\"Nation\"),(\"measures\",\"Population\")], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data?drilldowns=Nation&measures=Population" - }, - "query": "?measures=Population", - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-with-variables-2.output.yaml b/test/golden/file-package-with-variables-2.output.yaml new file mode 100644 index 0000000..18c77b1 --- /dev/null +++ b/test/golden/file-package-with-variables-2.output.yaml @@ -0,0 +1,15 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = + Just + "https://datausa.io/api/data?drilldowns=Nation&measures=Population" + , fileVariables = + fromList + [ ( "drilldowns" , "Nation" ) , ( "measures" , "Population" ) ] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data?drilldowns=Nation&measures=Population +query: ?measures=Population +status: 302 diff --git a/test/golden/file-package-with-variables-3.output.json b/test/golden/file-package-with-variables-3.output.json deleted file mode 100644 index d74bc3a..0000000 --- a/test/golden/file-package-with-variables-3.output.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "capture": "", - "headers": {}, - "query": "?measures=Population&drilldowns=Nation", - "status": 404 -} \ No newline at end of file diff --git a/test/golden/file-package-with-variables-3.output.yaml b/test/golden/file-package-with-variables-3.output.yaml new file mode 100644 index 0000000..8b0a248 --- /dev/null +++ b/test/golden/file-package-with-variables-3.output.yaml @@ -0,0 +1,4 @@ +capture: Nothing +headers: {} +query: ?measures=Population&drilldowns=Nation +status: 404 diff --git a/test/golden/file-package-with-variables-4.output.json b/test/golden/file-package-with-variables-4.output.json deleted file mode 100644 index 33fd3a0..0000000 --- a/test/golden/file-package-with-variables-4.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data\", fileVariables = fromList [(\"b\",\"data\"),(\"a\",\"api\")], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data" - }, - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-with-variables-4.output.yaml b/test/golden/file-package-with-variables-4.output.yaml new file mode 100644 index 0000000..7d8325f --- /dev/null +++ b/test/golden/file-package-with-variables-4.output.yaml @@ -0,0 +1,10 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Just "https://datausa.io/api/data" + , fileVariables = fromList [ ( "b" , "data" ) , ( "a" , "api" ) ] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data +status: 302 diff --git a/test/golden/file-package-with-variables-and-no-outgoing-url.output.json b/test/golden/file-package-with-variables-and-no-outgoing-url.output.json deleted file mode 100644 index 2d133c3..0000000 --- a/test/golden/file-package-with-variables-and-no-outgoing-url.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Nothing, fileVariables = fromList [(\"somevar\",\"very-nice\")], filePackage = \"4ba1cddc-3756-4fa3-8e80-e4db56b34816\"}", - "headers": {}, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/file-package-with-variables-and-no-outgoing-url.output.yaml b/test/golden/file-package-with-variables-and-no-outgoing-url.output.yaml new file mode 100644 index 0000000..8c2277f --- /dev/null +++ b/test/golden/file-package-with-variables-and-no-outgoing-url.output.yaml @@ -0,0 +1,9 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Nothing + , fileVariables = fromList [ ( "somevar" , "very-nice" ) ] + , filePackage = "4ba1cddc-3756-4fa3-8e80-e4db56b34816" + } +headers: {} +status: 200 diff --git a/test/golden/file-package-without-variable-2.output.json b/test/golden/file-package-without-variable-2.output.json deleted file mode 100644 index 5c924f3..0000000 --- a/test/golden/file-package-without-variable-2.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data\", fileVariables = fromList [(\"x\",\"xxx\")], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data" - }, - "query": "?drilldowns=Nation&measures=Population", - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-without-variable-2.output.yaml b/test/golden/file-package-without-variable-2.output.yaml new file mode 100644 index 0000000..4134065 --- /dev/null +++ b/test/golden/file-package-without-variable-2.output.yaml @@ -0,0 +1,11 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Just "https://datausa.io/api/data" + , fileVariables = fromList [ ( "x" , "xxx" ) ] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data +query: ?drilldowns=Nation&measures=Population +status: 302 diff --git a/test/golden/file-package-without-variable.output.json b/test/golden/file-package-without-variable.output.json deleted file mode 100644 index 7316d87..0000000 --- a/test/golden/file-package-without-variable.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data\", fileVariables = fromList [], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data" - }, - "query": "?drilldowns=Nation&measures=Population", - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-without-variable.output.yaml b/test/golden/file-package-without-variable.output.yaml new file mode 100644 index 0000000..e058e52 --- /dev/null +++ b/test/golden/file-package-without-variable.output.yaml @@ -0,0 +1,11 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Just "https://datausa.io/api/data" + , fileVariables = fromList [] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data +query: ?drilldowns=Nation&measures=Population +status: 302 diff --git a/test/golden/file-package-without-varible-1.output.json b/test/golden/file-package-without-varible-1.output.json deleted file mode 100644 index 0f3593e..0000000 --- a/test/golden/file-package-without-varible-1.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data?drilldowns=Nation&measures=Population\", fileVariables = fromList [], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data?drilldowns=Nation&measures=Population" - }, - "query": "?drilldowns=Nation&measures=Population", - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-without-varible-1.output.yaml b/test/golden/file-package-without-varible-1.output.yaml new file mode 100644 index 0000000..4c4ffcf --- /dev/null +++ b/test/golden/file-package-without-varible-1.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = + Just + "https://datausa.io/api/data?drilldowns=Nation&measures=Population" + , fileVariables = fromList [] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data?drilldowns=Nation&measures=Population +query: ?drilldowns=Nation&measures=Population +status: 302 diff --git a/test/golden/file-package-without-varible-2.output.json b/test/golden/file-package-without-varible-2.output.json deleted file mode 100644 index 0f3593e..0000000 --- a/test/golden/file-package-without-varible-2.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data?drilldowns=Nation&measures=Population\", fileVariables = fromList [], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data?drilldowns=Nation&measures=Population" - }, - "query": "?drilldowns=Nation&measures=Population", - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-without-varible-2.output.yaml b/test/golden/file-package-without-varible-2.output.yaml new file mode 100644 index 0000000..4c4ffcf --- /dev/null +++ b/test/golden/file-package-without-varible-2.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = + Just + "https://datausa.io/api/data?drilldowns=Nation&measures=Population" + , fileVariables = fromList [] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data?drilldowns=Nation&measures=Population +query: ?drilldowns=Nation&measures=Population +status: 302 diff --git a/test/golden/file-package-without-varible-3.output.json b/test/golden/file-package-without-varible-3.output.json deleted file mode 100644 index cfc7828..0000000 --- a/test/golden/file-package-without-varible-3.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data?drilldowns=Nation&measures=Population\", fileVariables = fromList [], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data?drilldowns=Nation&measures=Population" - }, - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-without-varible-3.output.yaml b/test/golden/file-package-without-varible-3.output.yaml new file mode 100644 index 0000000..f3b69fe --- /dev/null +++ b/test/golden/file-package-without-varible-3.output.yaml @@ -0,0 +1,12 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = + Just + "https://datausa.io/api/data?drilldowns=Nation&measures=Population" + , fileVariables = fromList [] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data?drilldowns=Nation&measures=Population +status: 302 diff --git a/test/golden/file-package-without-varible-4.output.json b/test/golden/file-package-without-varible-4.output.json deleted file mode 100644 index 874214d..0000000 --- a/test/golden/file-package-without-varible-4.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data\", fileVariables = fromList [], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data" - }, - "status": 302 -} \ No newline at end of file diff --git a/test/golden/file-package-without-varible-4.output.yaml b/test/golden/file-package-without-varible-4.output.yaml new file mode 100644 index 0000000..380c0ba --- /dev/null +++ b/test/golden/file-package-without-varible-4.output.yaml @@ -0,0 +1,10 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Just "https://datausa.io/api/data" + , fileVariables = fromList [] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data +status: 302 diff --git a/test/golden/issue-2535-1.output.json b/test/golden/issue-2535-1.output.json deleted file mode 100644 index 4d97502..0000000 --- a/test/golden/issue-2535-1.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://some.engineering/blah/blah\", fileVariables = fromList [(\"path\",\"blah/blah\")], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://some.engineering/blah/blah" - }, - "status": 302 -} \ No newline at end of file diff --git a/test/golden/issue-2535-1.output.yaml b/test/golden/issue-2535-1.output.yaml new file mode 100644 index 0000000..5901810 --- /dev/null +++ b/test/golden/issue-2535-1.output.yaml @@ -0,0 +1,10 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Just "https://some.engineering/blah/blah" + , fileVariables = fromList [ ( "path" , "blah/blah" ) ] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://some.engineering/blah/blah +status: 302 diff --git a/test/golden/issue-2535-2.output.json b/test/golden/issue-2535-2.output.json deleted file mode 100644 index f80511d..0000000 --- a/test/golden/issue-2535-2.output.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "capture": "DockerCapture {dockerCaptureImage = [\"someengineering\",\"resotoshell\"], dockerCaptureReference = \"latest\", dockerCaptureBackendRegistry = \"ghcr.io\", dockerCapturePackage = Just \"bd06145b-3f32-4f36-9755-69b3dfb6e71d\", dockerCaptureAutoCreate = Nothing}", - "headers": { - "Location": "https://ghcr.io/v2/someengineering/resotoshell/manifests/latest", - "X-This-Request-Was-Proxied": "1" - }, - "status": 307 -} \ No newline at end of file diff --git a/test/golden/issue-2535-2.output.yaml b/test/golden/issue-2535-2.output.yaml new file mode 100644 index 0000000..93ba008 --- /dev/null +++ b/test/golden/issue-2535-2.output.yaml @@ -0,0 +1,14 @@ +capture: |- + Just + DockerCapture + { dockerCaptureImage = [ "someengineering" , "resotoshell" ] + , dockerCaptureReference = "latest" + , dockerCaptureBackendRegistry = "ghcr.io" + , dockerCapturePackage = + Just "bd06145b-3f32-4f36-9755-69b3dfb6e71d" + , dockerCaptureAutoCreate = Nothing + } +headers: + Location: https://ghcr.io/v2/someengineering/resotoshell/manifests/latest + X-This-Request-Was-Proxied: '1' +status: 307 diff --git a/test/golden/pixel.output.json b/test/golden/pixel.output.json deleted file mode 100644 index b296ba2..0000000 --- a/test/golden/pixel.output.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "capture": "PixelCapture \"12345\"", - "headers": { - "Cache-control": "no-cache, no-store, must-revalidate", - "Content-Length": "24", - "Content-Type": "image/png" - }, - "query": "?x-pxid=12345", - "status": 200 -} \ No newline at end of file diff --git a/test/golden/pixel.output.yaml b/test/golden/pixel.output.yaml new file mode 100644 index 0000000..61615df --- /dev/null +++ b/test/golden/pixel.output.yaml @@ -0,0 +1,7 @@ +capture: Just (PixelCapture "12345") +headers: + Cache-control: no-cache, no-store, must-revalidate + Content-Length: '24' + Content-Type: image/png +query: ?x-pxid=12345 +status: 200 diff --git a/test/golden/python-test-caching.output.json b/test/golden/python-test-caching.output.json deleted file mode 100644 index 91290b1..0000000 --- a/test/golden/python-test-caching.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "PythonCapture {pythonCapturePackage = Nothing, pythonCaptureVersion = Nothing, pythonCaptureFileName = Nothing, pythonCaptureFileBackendURL = Nothing}", - "headers": { - "etag": "\"agnhjMSIWv0_F5FCrBDmit2jdkTb4QLM7v4tnUKUs-U=\"" - }, - "status": 304 -} \ No newline at end of file diff --git a/test/golden/python-test-caching.output.yaml b/test/golden/python-test-caching.output.yaml new file mode 100644 index 0000000..2beabed --- /dev/null +++ b/test/golden/python-test-caching.output.yaml @@ -0,0 +1,11 @@ +capture: |- + Just + PythonCapture + { pythonCapturePackage = Nothing + , pythonCaptureVersion = Nothing + , pythonCaptureFileName = Nothing + , pythonCaptureFileBackendURL = Nothing + } +headers: + etag: '"agnhjMSIWv0_F5FCrBDmit2jdkTb4QLM7v4tnUKUs-U="' +status: 304 diff --git a/test/golden/python-test-file.output.json b/test/golden/python-test-file.output.json deleted file mode 100644 index 9eba8de..0000000 --- a/test/golden/python-test-file.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "PythonCapture {pythonCapturePackage = Just \"123\", pythonCaptureVersion = Just \"1.3.0\", pythonCaptureFileName = Just \"numpy-1.3.0.tar.gz\", pythonCaptureFileBackendURL = Just \"https://files.pythonhosted.org/packages/ab/67/19e93e3f8c3e077dcf6fc54e84e1cff609c4a7e0a3ce14f70794dde60063/numpy-1.3.0.tar.gz#sha256=7524687cce85aa78103046db5e617c626b0ef871a203a049159f88f35647c90d\"}", - "headers": { - "Location": "https://files.pythonhosted.org/packages/ab/67/19e93e3f8c3e077dcf6fc54e84e1cff609c4a7e0a3ce14f70794dde60063/numpy-1.3.0.tar.gz#sha256=7524687cce85aa78103046db5e617c626b0ef871a203a049159f88f35647c90d" - }, - "status": 302 -} \ No newline at end of file diff --git a/test/golden/python-test-file.output.yaml b/test/golden/python-test-file.output.yaml new file mode 100644 index 0000000..d1871d7 --- /dev/null +++ b/test/golden/python-test-file.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + PythonCapture + { pythonCapturePackage = Just "123" + , pythonCaptureVersion = Just "1.3.0" + , pythonCaptureFileName = Just "numpy-1.3.0.tar.gz" + , pythonCaptureFileBackendURL = + Just + "https://files.pythonhosted.org/packages/ab/67/19e93e3f8c3e077dcf6fc54e84e1cff609c4a7e0a3ce14f70794dde60063/numpy-1.3.0.tar.gz#sha256=7524687cce85aa78103046db5e617c626b0ef871a203a049159f88f35647c90d" + } +headers: + Location: https://files.pythonhosted.org/packages/ab/67/19e93e3f8c3e077dcf6fc54e84e1cff609c4a7e0a3ce14f70794dde60063/numpy-1.3.0.tar.gz#sha256=7524687cce85aa78103046db5e617c626b0ef871a203a049159f88f35647c90d +status: 302 diff --git a/test/golden/python-test-hash.output.json b/test/golden/python-test-hash.output.json deleted file mode 100644 index 0c7f23c..0000000 --- a/test/golden/python-test-hash.output.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "capture": "PythonCapture {pythonCapturePackage = Just \"123\", pythonCaptureVersion = Nothing, pythonCaptureFileName = Nothing, pythonCaptureFileBackendURL = Nothing}", - "headers": { - "Content-Length": "351", - "Content-Type": "text/html", - "Etag": "\"poRjCQOfzSLEnMunwDeaf9iLsReZf61anTfTPU2nUEg=\"" - }, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/python-test-hash.output.yaml b/test/golden/python-test-hash.output.yaml new file mode 100644 index 0000000..43657fa --- /dev/null +++ b/test/golden/python-test-hash.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + PythonCapture + { pythonCapturePackage = Just "123" + , pythonCaptureVersion = Nothing + , pythonCaptureFileName = Nothing + , pythonCaptureFileBackendURL = Nothing + } +headers: + Content-Length: '351' + Content-Type: text/html + Etag: '"poRjCQOfzSLEnMunwDeaf9iLsReZf61anTfTPU2nUEg="' +status: 200 diff --git a/test/golden/python-test-non-existing-file.output.json b/test/golden/python-test-non-existing-file.output.json deleted file mode 100644 index f58c06e..0000000 --- a/test/golden/python-test-non-existing-file.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "capture": "", - "headers": {}, - "status": 404 -} \ No newline at end of file diff --git a/test/golden/python-test-non-existing-file.output.yaml b/test/golden/python-test-non-existing-file.output.yaml new file mode 100644 index 0000000..6b659a3 --- /dev/null +++ b/test/golden/python-test-non-existing-file.output.yaml @@ -0,0 +1,3 @@ +capture: Nothing +headers: {} +status: 404 diff --git a/test/golden/python-test-package-head.output.json b/test/golden/python-test-package-head.output.json deleted file mode 100644 index 8f3d84b..0000000 --- a/test/golden/python-test-package-head.output.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "capture": "PythonCapture {pythonCapturePackage = Just \"123\", pythonCaptureVersion = Nothing, pythonCaptureFileName = Nothing, pythonCaptureFileBackendURL = Nothing}", - "headers": { - "Content-Length": "126", - "Content-Type": "text/html", - "Etag": "\"Cb86PcykhhxBlk52ae8CdYlOomxqTrO8nKVpHYZFI3I=\"" - }, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/python-test-package-head.output.yaml b/test/golden/python-test-package-head.output.yaml new file mode 100644 index 0000000..75300ba --- /dev/null +++ b/test/golden/python-test-package-head.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + PythonCapture + { pythonCapturePackage = Just "123" + , pythonCaptureVersion = Nothing + , pythonCaptureFileName = Nothing + , pythonCaptureFileBackendURL = Nothing + } +headers: + Content-Length: '126' + Content-Type: text/html + Etag: '"Cb86PcykhhxBlk52ae8CdYlOomxqTrO8nKVpHYZFI3I="' +status: 200 diff --git a/test/golden/python-test-package.output.json b/test/golden/python-test-package.output.json deleted file mode 100644 index 6d66659..0000000 --- a/test/golden/python-test-package.output.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "capture": "PythonCapture {pythonCapturePackage = Just \"123\", pythonCaptureVersion = Nothing, pythonCaptureFileName = Nothing, pythonCaptureFileBackendURL = Nothing}", - "headers": { - "Content-Length": "196", - "Content-Type": "text/html", - "Etag": "\"nKXJKw6bVHghW5Egg1iiVvuSBLklJQSE0o9KKqNJllU=\"" - }, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/python-test-package.output.yaml b/test/golden/python-test-package.output.yaml new file mode 100644 index 0000000..5780ada --- /dev/null +++ b/test/golden/python-test-package.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + PythonCapture + { pythonCapturePackage = Just "123" + , pythonCaptureVersion = Nothing + , pythonCaptureFileName = Nothing + , pythonCaptureFileBackendURL = Nothing + } +headers: + Content-Length: '196' + Content-Type: text/html + Etag: '"nKXJKw6bVHghW5Egg1iiVvuSBLklJQSE0o9KKqNJllU="' +status: 200 diff --git a/test/golden/python-test-root-head.output.json b/test/golden/python-test-root-head.output.json deleted file mode 100644 index 5d1c67e..0000000 --- a/test/golden/python-test-root-head.output.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "capture": "PythonCapture {pythonCapturePackage = Nothing, pythonCaptureVersion = Nothing, pythonCaptureFileName = Nothing, pythonCaptureFileBackendURL = Nothing}", - "headers": { - "Content-Length": "81", - "Content-Type": "text/html", - "Etag": "\"V5vrPPiIHdnkkoBivA0iBAHsMgm_e-IFA0AhY9HoOEw=\"" - }, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/python-test-root-head.output.yaml b/test/golden/python-test-root-head.output.yaml new file mode 100644 index 0000000..619a781 --- /dev/null +++ b/test/golden/python-test-root-head.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + PythonCapture + { pythonCapturePackage = Nothing + , pythonCaptureVersion = Nothing + , pythonCaptureFileName = Nothing + , pythonCaptureFileBackendURL = Nothing + } +headers: + Content-Length: '81' + Content-Type: text/html + Etag: '"V5vrPPiIHdnkkoBivA0iBAHsMgm_e-IFA0AhY9HoOEw="' +status: 200 diff --git a/test/golden/python-test-root.output.json b/test/golden/python-test-root.output.json deleted file mode 100644 index 03fd4ae..0000000 --- a/test/golden/python-test-root.output.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "capture": "PythonCapture {pythonCapturePackage = Nothing, pythonCaptureVersion = Nothing, pythonCaptureFileName = Nothing, pythonCaptureFileBackendURL = Nothing}", - "headers": { - "Content-Length": "118", - "Content-Type": "text/html", - "Etag": "\"agnhjMSIWv0_F5FCrBDmit2jdkTb4QLM7v4tnUKUs-U=\"" - }, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/python-test-root.output.yaml b/test/golden/python-test-root.output.yaml new file mode 100644 index 0000000..979c681 --- /dev/null +++ b/test/golden/python-test-root.output.yaml @@ -0,0 +1,13 @@ +capture: |- + Just + PythonCapture + { pythonCapturePackage = Nothing + , pythonCaptureVersion = Nothing + , pythonCaptureFileName = Nothing + , pythonCaptureFileBackendURL = Nothing + } +headers: + Content-Length: '118' + Content-Type: text/html + Etag: '"agnhjMSIWv0_F5FCrBDmit2jdkTb4QLM7v4tnUKUs-U="' +status: 200 diff --git a/test/golden/re-file-package-test-1.output.json b/test/golden/re-file-package-test-1.output.json deleted file mode 100644 index 33fd3a0..0000000 --- a/test/golden/re-file-package-test-1.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/api/data\", fileVariables = fromList [(\"b\",\"data\"),(\"a\",\"api\")], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/api/data" - }, - "status": 302 -} \ No newline at end of file diff --git a/test/golden/re-file-package-test-1.output.yaml b/test/golden/re-file-package-test-1.output.yaml new file mode 100644 index 0000000..7d8325f --- /dev/null +++ b/test/golden/re-file-package-test-1.output.yaml @@ -0,0 +1,10 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = Just "https://datausa.io/api/data" + , fileVariables = fromList [ ( "b" , "data" ) , ( "a" , "api" ) ] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/api/data +status: 302 diff --git a/test/golden/re-file-package-test-2.output.json b/test/golden/re-file-package-test-2.output.json deleted file mode 100644 index c34c26d..0000000 --- a/test/golden/re-file-package-test-2.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "FlatfileCapture {fileAbsoluteUrl = Just \"https://datausa.io/some-example-package/0.1.2.4-head\", fileVariables = fromList [(\"packageName\",\"some-example-package\"),(\"version\",\"0.1.2.4-head\")], filePackage = \"a1b331fa-1539-49e5-bdc4-dc8a48e586d1\"}", - "headers": { - "Location": "https://datausa.io/some-example-package/0.1.2.4-head" - }, - "status": 302 -} \ No newline at end of file diff --git a/test/golden/re-file-package-test-2.output.yaml b/test/golden/re-file-package-test-2.output.yaml new file mode 100644 index 0000000..da1bd0f --- /dev/null +++ b/test/golden/re-file-package-test-2.output.yaml @@ -0,0 +1,15 @@ +capture: |- + Just + FlatfileCapture + { fileAbsoluteUrl = + Just "https://datausa.io/some-example-package/0.1.2.4-head" + , fileVariables = + fromList + [ ( "packageName" , "some-example-package" ) + , ( "version" , "0.1.2.4-head" ) + ] + , filePackage = "a1b331fa-1539-49e5-bdc4-dc8a48e586d1" + } +headers: + Location: https://datausa.io/some-example-package/0.1.2.4-head +status: 302 diff --git a/test/golden/scarfjs-1.output.json b/test/golden/scarfjs-1.output.json deleted file mode 100644 index 632d697..0000000 --- a/test/golden/scarfjs-1.output.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "capture": "ScarfJsCapture {scarfJsRequestBody = Object (fromList [(\"dependencyInfo\",Object (fromList [])),(\"libraryType\",String \"npm\"),(\"rawArch\",String \"x86_64\"),(\"rawPlatform\",String \"osx\")]), scarfJsPackage = Nothing}", - "headers": { - "Content-Type": "application/json" - }, - "status": 200 -} \ No newline at end of file diff --git a/test/golden/scarfjs-1.output.yaml b/test/golden/scarfjs-1.output.yaml new file mode 100644 index 0000000..3ea0ad1 --- /dev/null +++ b/test/golden/scarfjs-1.output.yaml @@ -0,0 +1,16 @@ +capture: |- + Just + ScarfJsCapture + { scarfJsRequestBody = + Object + (fromList + [ ( "dependencyInfo" , Object (fromList []) ) + , ( "libraryType" , String "npm" ) + , ( "rawArch" , String "x86_64" ) + , ( "rawPlatform" , String "osx" ) + ]) + , scarfJsPackage = Nothing + } +headers: + Content-Type: application/json +status: 200