Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ add-license:

.PHONY: treefmt
treefmt:
treefmt
Copy link
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 treefmt was very chatty about files it's not allowed to format

treefmt -u debug

.PHONY: treefmt-check
treefmt-check:
treefmt --fail-on-change
treefmt --fail-on-change -u debug

#################################
## docker targets
Expand Down
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
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
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
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
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
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
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
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
3 changes: 1 addition & 2 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 @@ -139,11 +138,11 @@ mkDerivation {
bytestring-conversion
crypton
crypton-connection
data-default
dns-util
exceptions
HsOpenSSL
hspec
hspec-core
hspec-junit-formatter
http-client-tls
http-types
Expand Down
2 changes: 1 addition & 1 deletion services/federator/federator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ executable federator-integration
, 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
20 changes: 11 additions & 9 deletions services/federator/test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@
--
-- 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/>.
{-# OPTIONS_GHC -Wno-deprecations #-}

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

import Control.Concurrent.Async
import Control.Concurrent.Async (concurrently_)
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
Expand All @@ -39,8 +36,14 @@ main = withOpenSSL $ do
env <- withArgs wireArgs mkEnvFromOptions
-- withArgs hspecArgs . hspec $ do
-- beforeAll (pure env) . afterAll destroyEnv $ Hspec.mkspec
cfg <- hspecConfig
withArgs hspecArgs . hspecWith cfg $ mkspec env

-- FUTUREWORK(mangoiv): we should remove the deprecated module and instaed move to this config, however, this
-- needs check of whether it modifies the behaviour
-- junitConfig <- envJUnitConfig
-- withArgs hspecArgs . hspec . add junitConfig $ do

conf <- hspecConfig
withArgs hspecArgs . hspecWith conf $ mkspec env

hspecConfig :: IO Config
hspecConfig = do
Expand All @@ -52,7 +55,6 @@ hspecConfig = do
: configAvailableFormatters defaultConfig
}
where
checksAndJUnitFormatter :: JUnitConfig -> FormatConfig -> IO Format
checksAndJUnitFormatter junitConfig config = do
junit <- junitFormat junitConfig config
let checksFormatter = fromJust (lookup "checks" $ configAvailableFormatters defaultConfig)
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
2 changes: 0 additions & 2 deletions services/spar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
, hscim
, HsOpenSSL
, hspec
, hspec-core
, hspec-discover
, hspec-junit-formatter
, hspec-wai
Expand Down Expand Up @@ -162,7 +161,6 @@ mkDerivation {
hscim
HsOpenSSL
hspec
hspec-core
hspec-junit-formatter
hspec-wai
http-api-data
Expand Down
6 changes: 3 additions & 3 deletions services/spar/spar.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ executable spar
executable spar-integration
main-is: Main.hs

-- cabal-fmt: expand test-integration
-- we should not use cabal-fmt expand here because `Main` should not be in `other-modules`, it's wrong
-- and cabal chokes on it
-- FUTUREWORK(mangoiv): move Main to a different directory such that this one can be expanded
other-modules:
Main
Test.LoggingSpec
Test.MetricsSpec
Test.Spar.APISpec
Expand Down Expand Up @@ -355,7 +356,6 @@ executable spar-integration
, hscim
, HsOpenSSL
, hspec
, hspec-core
, hspec-junit-formatter
, hspec-wai
, http-api-data
Expand Down
16 changes: 10 additions & 6 deletions services/spar/test-integration/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -Wno-deprecations #-}

-- This file is part of the Wire Server implementation.
--
Expand Down Expand Up @@ -29,7 +30,7 @@
-- the solution: https://github.com/hspec/hspec/pull/397.
module Main where

import Control.Concurrent.Async
import Control.Concurrent.Async (concurrently_)
import Control.Lens ((.~), (^.))
import Data.Text (pack)
import Imports
Expand All @@ -38,10 +39,9 @@ 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.Runner (Config (configAvailableFormatters), defaultConfig, hspecWith)
import qualified Test.LoggingSpec
import qualified Test.MetricsSpec
import qualified Test.Spar.APISpec
Expand All @@ -58,8 +58,13 @@ main :: IO ()
main = do
(wireArgs, hspecArgs) <- partitionArgs <$> getArgs
let env = withArgs wireArgs mkEnvFromOptions
cfg <- hspecConfig
withArgs hspecArgs . hspecWith cfg $ do
-- FUTUREWORK(mangoiv): we should remove the deprecated module and instaed move to this config, however, this
-- needs check of whether it modifies the behaviour
-- junitConfig <- envJUnitConfig
-- withArgs hspecArgs . hspec . add junitConfig $ do

conf <- hspecConfig
withArgs hspecArgs . hspecWith conf $ do
for_ [minBound ..] $ \idpApiVersion -> do
describe (show idpApiVersion) . beforeAll (env <&> teWireIdPAPIVersion .~ idpApiVersion) . afterAll destroyEnv $ do
mkspecMisc
Expand All @@ -77,7 +82,6 @@ hspecConfig = do
: configAvailableFormatters defaultConfig
}
where
checksAndJUnitFormatter :: JUnitConfig -> FormatConfig -> IO Format
checksAndJUnitFormatter junitConfig config = do
junit <- junitFormat junitConfig config
let checksFormatter = fromJust (lookup "checks" $ configAvailableFormatters defaultConfig)
Expand Down