Group configuration by component ownership
This commit is contained in:
parent
48a5b8a433
commit
67cc0cb802
1 changed files with 486 additions and 258 deletions
|
|
@ -13,6 +13,8 @@ import qualified Data.Text.Encoding as TE
|
|||
import Database.PostgreSQL.Simple (Only (..))
|
||||
import Nuthatch.Config
|
||||
( Config (..)
|
||||
, ProductConfig (..)
|
||||
, S3Config (..)
|
||||
, loadConfig
|
||||
, revealSecret
|
||||
, secret
|
||||
|
|
@ -33,13 +35,13 @@ import Nuthatch.Types
|
|||
main :: IO ()
|
||||
main = do
|
||||
config <- loadConfig
|
||||
withDb config $ \database -> do
|
||||
migrate database "sql" config
|
||||
migrate database "sql" config
|
||||
withDb (cfgPostgres config) $ \database -> do
|
||||
migrate database "sql" (cfgProduct config)
|
||||
migrate database "sql" (cfgProduct config)
|
||||
verifySchema database
|
||||
verifyAdmission database config
|
||||
verifyRowDecoder database
|
||||
store <- newS3 config
|
||||
store <- newS3 (cfgS3 config)
|
||||
verifyStorage config store
|
||||
putStrLn "Storage foundation integration gate passed"
|
||||
|
||||
|
|
@ -112,18 +114,19 @@ verifyAdmission database config = do
|
|||
|
||||
let personalUser = UserId "personal-limit-user"
|
||||
personal = personalPool personalUser
|
||||
productCfg = cfgProduct config
|
||||
ensurePersonalPool database
|
||||
config { cfgPersonalQuotaBytes = 30 }
|
||||
productCfg { cfgPersonalQuotaBytes = 30 }
|
||||
personalUser
|
||||
ensurePersonalPool database
|
||||
config { cfgPersonalQuotaBytes = 40 }
|
||||
productCfg { cfgPersonalQuotaBytes = 40 }
|
||||
personalUser
|
||||
_ <- Db.execute database
|
||||
"UPDATE pools SET reserved_bytes = 35 WHERE pool_id = ?"
|
||||
(Only (unPoolId personal))
|
||||
personalLower <- try
|
||||
(ensurePersonalPool database
|
||||
config { cfgPersonalQuotaBytes = 34 }
|
||||
productCfg { cfgPersonalQuotaBytes = 34 }
|
||||
personalUser)
|
||||
:: IO (Either SomeException ())
|
||||
assert "unsafe personal limit reduction rejected" (isLeft personalLower)
|
||||
|
|
@ -326,9 +329,10 @@ verifyStorage config store = do
|
|||
|
||||
missing <- getObjectBytes store (ObjectKey "shared/missing")
|
||||
assertEqual "typed not-found error" (Left S3NotFound) missing
|
||||
deniedStore <- newS3 config
|
||||
let s3Cfg = cfgS3 config
|
||||
deniedStore <- newS3 s3Cfg
|
||||
{ cfgS3SecretKey =
|
||||
secret (revealSecret (cfgS3SecretKey config) <> "-invalid")
|
||||
secret (revealSecret (cfgS3SecretKey s3Cfg) <> "-invalid")
|
||||
}
|
||||
denied <- listObjects deniedStore "" Nothing Nothing 1
|
||||
case denied of
|
||||
|
|
|
|||
Loading…
Reference in a new issue