Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ program-options
allow-newer:
, proto-lens-protoc:base
, proto-lens-protoc:ghc
, proto-lens-setup:Cabal
2 changes: 1 addition & 1 deletion integration/integration.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build-type: Custom
custom-setup
setup-depends:
, base
, Cabal
, Cabal >=3.12

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this constraint needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because otherwise cabal multi-repl doesn't work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I put a note there?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there only one version of Cabal available in the nix env? The project as is doesn't depend on cabal multi-repl right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in theory yes, in practice no, Cabal is a boot library and hence belongs to the GHC, hence nixpkgs installs two versions, 3.12 and 3.10 (which comes with GHC and cannot be removed), that then leads to proto-lens tool to select the wrong (old) version because it is actually constrained to Cabal <3.12 for no particular reason. It's all a bit messed up, if we had purely nixpkgs deps, then this wouldn't cause any issues because cabal doesn't actually care about how these deps have been installed...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason why cabal multi-repl is not enabled by default in HLS. By fixing this for us though, it removes the bug wrt duplicate constraints and it also improves HLS because of multi-repl. I think adding this constraint (which is provisioned by the nix env anyway) is worth this improvement.

, containers
, directory
, filepath
Expand Down
2 changes: 1 addition & 1 deletion libs/types-common-journal/types-common-journal.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extra-source-files:
custom-setup
setup-depends:
base
, Cabal
, Cabal >=3.12
, proto-lens-setup

library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extra-source-files:
custom-setup
setup-depends:
base
, Cabal
, Cabal >=3.12
, proto-lens-setup

library
Expand Down
2 changes: 1 addition & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let
docsPkgs = [
pkgs.plantuml
pkgs.texlive.combined.scheme-full
(pkgs.python3.withPackages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is because nixpkgs not too long ago bumped the default python version and now many python packages are broken

(pkgs.python310.withPackages
(ps: with ps; [
myst-parser
rst2pdf
Expand Down
7 changes: 0 additions & 7 deletions nix/haskell-pins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,6 @@ let
};
# end pinned dependencies for http2

# pinned for warp
warp-tls = {
version = "3.4.5";
sha256 = "sha256-3cDi/+n7wHfcWT/iFWAsGdLYXtKYXmvzolDt+ACJnaM=";
};
# end pinned for warp

# PR: https://github.com/wireapp/wire-server/pull/4027
HsOpenSSL = {
version = "0.11.7.7";
Expand Down
13 changes: 9 additions & 4 deletions nix/manual-overrides.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ libsodium, protobuf, hlib, mls-test-cli, fetchurl, curl, fetchpatch, ... }:
{ libsodium, protobuf, hlib, mls-test-cli, fetchurl, curl, ... }:
# FUTUREWORK: Figure out a way to detect if some of these packages are not
# actually marked broken, so we can cleanup this file on every nixpkgs bump.
hself: hsuper: {
Expand Down Expand Up @@ -55,7 +55,6 @@ hself: hsuper: {

# depend on an old version of hedgehog
polysemy-test = hlib.markUnbroken (hlib.doJailbreak hsuper.polysemy-test);
polysemy-conc = hlib.markUnbroken (hlib.doJailbreak hsuper.polysemy-conc);

# ------------------------------------
# okay but marked broken (nixpkgs bug)
Expand All @@ -67,12 +66,18 @@ hself: hsuper: {
# version overrides
# (these are fine but will probably need to be adjusted in a future nixpkgs update)
# -----------------
tls = hsuper.tls_2_0_5;
tls-session-manager = hsuper.tls-session-manager_0_0_5;
tls = hsuper.tls_2_1_0;
tls-session-manager = hsuper.tls-session-manager_0_0_6;
crypton-connection = hsuper.crypton-connection_0_4_1; # older version doesn't allow tls 2.1
amqp = hlib.dontCheck hsuper.amqp_0_23_0; # older version doesn't allow cryton-connection 0.4.1, this one has broken tests

# warp requires curl in its testsuite
warp = hlib.addTestToolDepends hsuper.warp [ curl ];

# cabal multirepl requires Cabal 3.12
Cabal = hsuper.Cabal_3_12_1_0;
Cabal-syntax = hsuper.Cabal-syntax_3_12_1_0;

# -----------------
# flags and patches
# (these are fine)
Expand Down
4 changes: 2 additions & 2 deletions nix/overlay-docs.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
self: super: rec {
python3 = super.python3.override {
python310 = super.python310.override {
packageOverrides = pself: psuper: {
rst2pdf = pself.callPackage ./pkgs/python-docs/rst2pdf.nix { };
sphinx-multiversion = pself.callPackage ./pkgs/python-docs/sphinx-multiversion.nix { };
Expand All @@ -9,5 +9,5 @@ self: super: rec {
};
};

python3Packages = python3.pkgs;
python310Packages = python310.pkgs;
}
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4a3fc4cf736b7d2d288d7a8bf775ac8d4c0920b4",
"sha256": "1ibmc6iijim53bpi1wc1b295l579wzxgs8ynmsi0ldgjrxhgli1a",
"rev": "f3834de3782b82bfc666abf664f946d0e7d1f116",
"sha256": "0kzp4d4hbsc968wavwyh31lzipd4cv7wvnca167y21l5rb1kx9az",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/4a3fc4cf736b7d2d288d7a8bf775ac8d4c0920b4.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/f3834de3782b82bfc666abf664f946d0e7d1f116.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
6 changes: 3 additions & 3 deletions nix/wire-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ in
pkgs.kind
pkgs.netcat
pkgs.niv
(hlib.justStaticExecutables pkgs.haskellPackages.apply-refact)
(pkgs.python3.withPackages
pkgs.haskellPackages.apply-refact
(pkgs.python310.withPackages
(ps: with ps; [
black
bokeh
Expand Down Expand Up @@ -547,7 +547,7 @@ in
++ pkgs.lib.optionals pkgs.stdenv.isLinux [
# linux-only, not strictly required tools
pkgs.docker-compose
pkgs.telepresence
(pkgs.telepresence.override { pythonPackages = pkgs.python310Packages; })
];
};

Expand Down
4 changes: 1 addition & 3 deletions services/federator/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
, hinotify
, HsOpenSSL
, hspec
, hspec-core
, hspec-junit-formatter
, http-client
, http-client-tls
Expand Down Expand Up @@ -131,19 +130,18 @@ mkDerivation {
];
executableHaskellDepends = [
aeson
async
base
bilge
binary
bytestring
bytestring-conversion
crypton
crypton-connection
data-default
dns-util
exceptions
HsOpenSSL
hspec
hspec-core
hspec-junit-formatter
http-client-tls
http-types
Expand Down
3 changes: 1 addition & 2 deletions services/federator/federator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -277,20 +277,19 @@ executable federator-integration

build-depends:
aeson
, async
, base
, bilge
, binary
, bytestring
, bytestring-conversion
, crypton
, crypton-connection
, data-default
, dns-util
, exceptions
, federator
, HsOpenSSL
, hspec
, hspec-core
, hspec-junit-formatter
, http-client-tls
, http-types
Expand Down
30 changes: 3 additions & 27 deletions services/federator/test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,26 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Main
( main,
)
where
module Main (main) where

import Control.Concurrent.Async
import Imports
import OpenSSL (withOpenSSL)
import System.Environment (withArgs)
import Test.Federator.IngressSpec qualified
import Test.Federator.InwardSpec qualified
import Test.Federator.Util (TestEnv, mkEnvFromOptions)
import Test.Hspec
import Test.Hspec.Core.Format
import Test.Hspec.JUnit
import Test.Hspec.JUnit.Config.Env
import Test.Hspec.Runner
import Test.Hspec.JUnit.Formatter

main :: IO ()
main = withOpenSSL $ do
(wireArgs, hspecArgs) <- partitionArgs <$> getArgs
env <- withArgs wireArgs mkEnvFromOptions
-- withArgs hspecArgs . hspec $ do
-- beforeAll (pure env) . afterAll destroyEnv $ Hspec.mkspec
cfg <- hspecConfig
withArgs hspecArgs . hspecWith cfg $ mkspec env

hspecConfig :: IO Config
hspecConfig = do
junitConfig <- envJUnitConfig
pure $
defaultConfig
{ configAvailableFormatters =
("junit", checksAndJUnitFormatter junitConfig)
: configAvailableFormatters defaultConfig
}
where
checksAndJUnitFormatter :: JUnitConfig -> FormatConfig -> IO Format
checksAndJUnitFormatter junitConfig config = do
junit <- junitFormat junitConfig config
let checksFormatter = fromJust (lookup "checks" $ configAvailableFormatters defaultConfig)
checks <- checksFormatter config
pure $ \event -> do
concurrently_ (junit event) (checks event)
withArgs hspecArgs . hspec . add junitConfig $ mkspec env
Comment thread
MangoIV marked this conversation as resolved.
Outdated

partitionArgs :: [String] -> ([String], [String])
partitionArgs = go [] []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import Data.Aeson
import Data.Aeson.TH
import Data.Aeson.Types qualified as Aeson
import Data.ByteString.Char8 qualified as C8
import Data.Default (def)
import Data.Id
import Data.Misc
import Data.String.Conversions
Expand Down Expand Up @@ -151,7 +152,7 @@ cliOptsParser =
-- | Create an environment for integration tests from integration and federator config files.
mkEnv :: (HasCallStack) => IntegrationConfig -> Opts -> IO TestEnv
mkEnv _teTstOpts _teOpts = do
let managerSettings = mkManagerSettings (Network.Connection.TLSSettingsSimple True False False) Nothing
let managerSettings = mkManagerSettings (Network.Connection.TLSSettingsSimple True False False def) Nothing
_teMgr :: Manager <- newManager managerSettings
let _teBrig = endpointToReq _teTstOpts.brig
_teCargohold = endpointToReq _teTstOpts.cargohold
Expand Down
4 changes: 0 additions & 4 deletions services/spar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{ mkDerivation
, aeson
, aeson-qq
, async
, base
, base64-bytestring
, bilge
Expand All @@ -27,7 +26,6 @@
, hscim
, HsOpenSSL
, hspec
, hspec-core
, hspec-discover
, hspec-junit-formatter
, hspec-wai
Expand Down Expand Up @@ -142,7 +140,6 @@ mkDerivation {
executableHaskellDepends = [
aeson
aeson-qq
async
base
base64-bytestring
bilge
Expand All @@ -162,7 +159,6 @@ mkDerivation {
hscim
HsOpenSSL
hspec
hspec-core
hspec-junit-formatter
hspec-wai
http-api-data
Expand Down
2 changes: 0 additions & 2 deletions services/spar/spar.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ executable spar-integration
build-depends:
aeson
, aeson-qq
, async
, base
, base64-bytestring
, bilge
Expand All @@ -355,7 +354,6 @@ executable spar-integration
, hscim
, HsOpenSSL
, hspec
, hspec-core
, hspec-junit-formatter
, hspec-wai
, http-api-data
Expand Down
27 changes: 3 additions & 24 deletions services/spar/test-integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
-- the solution: https://github.com/hspec/hspec/pull/397.
module Main where

import Control.Concurrent.Async
import Control.Lens ((.~), (^.))
import Data.Text (pack)
import Imports
Expand All @@ -38,10 +37,8 @@ import Spar.Run (mkApp)
import System.Environment (withArgs)
import System.Random (randomRIO)
import Test.Hspec
import Test.Hspec.Core.Format
import Test.Hspec.Core.Runner
import Test.Hspec.JUnit
import Test.Hspec.JUnit.Config.Env
import Test.Hspec.JUnit.Formatter
import qualified Test.LoggingSpec
import qualified Test.MetricsSpec
import qualified Test.Spar.APISpec
Expand All @@ -58,33 +55,15 @@ main :: IO ()
main = do
(wireArgs, hspecArgs) <- partitionArgs <$> getArgs
let env = withArgs wireArgs mkEnvFromOptions
cfg <- hspecConfig
withArgs hspecArgs . hspecWith cfg $ do
junitConfig <- envJUnitConfig
withArgs hspecArgs . hspec . add junitConfig $ do
for_ [minBound ..] $ \idpApiVersion -> do
describe (show idpApiVersion) . beforeAll (env <&> teWireIdPAPIVersion .~ idpApiVersion) . afterAll destroyEnv $ do
mkspecMisc
mkspecSaml
mkspecScim
mkspecHscimAcceptance env destroyEnv

hspecConfig :: IO Config
hspecConfig = do
junitConfig <- envJUnitConfig
pure $
defaultConfig
{ configAvailableFormatters =
("junit", checksAndJUnitFormatter junitConfig)
: configAvailableFormatters defaultConfig
}
where
checksAndJUnitFormatter :: JUnitConfig -> FormatConfig -> IO Format
checksAndJUnitFormatter junitConfig config = do
junit <- junitFormat junitConfig config
let checksFormatter = fromJust (lookup "checks" $ configAvailableFormatters defaultConfig)
checks <- checksFormatter config
pure $ \event -> do
concurrently_ (junit event) (checks event)

partitionArgs :: [String] -> ([String], [String])
partitionArgs = go [] []
where
Expand Down