Skip to content

Commit aaa656f

Browse files
committed
Run tests without SAML2_WEB_SSO_ROOT env var
Having to define this var just makes things complicated.
1 parent f1f18c9 commit aaa656f

File tree

9 files changed

+237
-27
lines changed

9 files changed

+237
-27
lines changed

NOTES.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Test failures ES 7
2+
3+
```
4+
FAIL
5+
Exception: IndexUpdateError (EsError {errorStatus = 400, errorMessage = "Action/metadata line [1] contains an unknown parameter [_version]"})
6+
Use -p '(!/turn/&&!/user.auth.cookies.limit/)&&$0=="Brig API Integration.search.index migration.migration to new index from database"' to rerun this test only.
7+
migration to new index from database (force sync): FAIL
8+
Exception: IndexUpdateError (EsError {errorStatus = 400, errorMessage = "Action/metadata line [1] contains an unknown parameter [_version]"})
9+
Use -p '(!/turn/&&!/user.auth.cookies.limit/)&&/migration to new index from database (force sync)/' to rerun this test only.
10+
team A: SearchVisibilityStandard (= unrestricted outbound search)
11+
team A: SearchableByOwnTeam (= restricted inbound search)
12+
I. non-team user cannot find team A member by display name
13+
```
14+
15+
```
16+
brig-index create
17+
should create an index when it is not present: FAIL (0.18s)
18+
Error message: Refresh interval should be set
19+
expected: [RefreshInterval 5s]
20+
but got: [RefreshInterval 5s,RoutingAllocationInclude (NodeAttrFilter {nodeAttrFilterName = NodeAttrName "_tier_preference", nodeAttrFilterValues = "data_content" :| []} :| [])]
21+
CallStack (from HasCallStack):
22+
assertFailure, called at ./Test/Tasty/HUnit/Orig.hs:68:32 in tasty-hunit-0.10.1-B1ADdVA8ZkWIn4pNJBh2N9:Test.Tasty.HUnit.Orig
23+
assertEqual, called at test/integration/Index/Create.hs:89:15 in main:Index.Create
24+
Use -p '(!/turn/&&!/user.auth.cookies.limit/)&&/should create an index when it is not present/' to rerun this test only.
25+
should not update anything when index already exists: FAIL (0.16s)
26+
Error message: Refresh interval should not be updated
27+
expected: []
28+
but got: [RoutingAllocationInclude (NodeAttrFilter {nodeAttrFilterName = NodeAttrName "_tier_preference", nodeAttrFilterValues = "data_content" :| []} :| [])]
29+
CallStack (from HasCallStack):
30+
assertFailure, called at ./Test/Tasty/HUnit/Orig.hs:68:32 in tasty-hunit-0.10.1-B1ADdVA8ZkWIn4pNJBh2N9:Test.Tasty.HUnit.Orig
31+
assertEqual, called at test/integration/Index/Create.hs:135:15 in main:Index.Create
32+
Use -p '(!/turn/&&!/user.auth.cookies.limit/)&&/should not update anything when index already exists/' to rerun this test only.
33+
```
34+
35+
# TOPICS
36+
37+
- Reduce wire-server options / Simplify Helm charts (from C&D)
38+
- Continue our refactorings Polysemy / Servant / integration tests
39+
- In case, make steps towards getting rid of Cassandra
40+
- Go towards Nix flake setup for wire-server
41+
- Update dependencies 😬

create_index_release.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
docker run --network=host --entrypoint=/bin/bash --rm -it quay.io/wire/brig-index:5.11.0 -c "
6+
echo 'username: elastic' > /tmp/credentials.yaml && \
7+
echo 'password: changeme' >> /tmp/credentials.yaml && \
8+
brig-index create --elasticsearch-server https://localhost:9200 --elasticsearch-insecure-skip-tls-verify --elasticsearch-credentials /tmp/credentials.yaml --elasticsearch-index $1 && \
9+
brig-index reindex --elasticsearch-server https://localhost:9200 --elasticsearch-insecure-skip-tls-verify --elasticsearch-credentials /tmp/credentials.yaml --elasticsearch-index $1
10+
"

get_index.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
curl -u 'elastic:changeme' --cacert deploy/dockerephemeral/docker/elasticsearch-ca.pem "https://localhost:9200/$1/?pretty" | jq .
6+

hls.json

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"cabalFormattingProvider": "cabal-gild",
3+
"checkParents": "CheckOnSave",
4+
"checkProject": false,
5+
"formattingProvider": "ormolu",
6+
"maxCompletions": 40,
7+
"plugin": {
8+
"alternateNumberFormat": {
9+
"globalOn": true
10+
},
11+
"cabal": {
12+
"codeActionsOn": false,
13+
"completionOn": false,
14+
"diagnosticsOn":false
15+
},
16+
"cabal-fmt": {
17+
"config": {
18+
"path": "cabal-fmt"
19+
}
20+
},
21+
"cabal-gild": {
22+
"config": {
23+
"path": "cabal-gild"
24+
}
25+
},
26+
"callHierarchy": {
27+
"globalOn": true
28+
},
29+
"changeTypeSignature": {
30+
"globalOn": true
31+
},
32+
"class": {
33+
"codeActionsOn": true,
34+
"codeLensOn": true
35+
},
36+
"eval": {
37+
"config": {
38+
"diff": true,
39+
"exception": false
40+
},
41+
"globalOn": true
42+
},
43+
"explicit-fields": {
44+
"globalOn": true
45+
},
46+
"explicit-fixity": {
47+
"globalOn": true
48+
},
49+
"fourmolu": {
50+
"config": {
51+
"external": false,
52+
"path": "fourmolu"
53+
}
54+
},
55+
"gadt": {
56+
"globalOn": true
57+
},
58+
"ghcide-code-actions-bindings": {
59+
"globalOn": true
60+
},
61+
"ghcide-code-actions-fill-holes": {
62+
"globalOn": true
63+
},
64+
"ghcide-code-actions-imports-exports": {
65+
"globalOn": true
66+
},
67+
"ghcide-code-actions-type-signatures": {
68+
"globalOn": true
69+
},
70+
"ghcide-completions": {
71+
"config": {
72+
"autoExtendOn": true,
73+
"snippetsOn": true
74+
},
75+
"globalOn": true
76+
},
77+
"ghcide-hover-and-symbols": {
78+
"hoverOn": true,
79+
"symbolsOn": true
80+
},
81+
"ghcide-type-lenses": {
82+
"config": {
83+
"mode": "always"
84+
},
85+
"globalOn": true
86+
},
87+
"hlint": {
88+
"codeActionsOn": true,
89+
"config": {
90+
"flags": []
91+
},
92+
"diagnosticsOn": true
93+
},
94+
"importLens": {
95+
"codeActionsOn": true,
96+
"codeLensOn": true
97+
},
98+
"moduleName": {
99+
"globalOn": true
100+
},
101+
"ormolu": {
102+
"config": {
103+
"external": false
104+
}
105+
},
106+
"overloaded-record-dot": {
107+
"globalOn": true
108+
},
109+
"pragmas-completion": {
110+
"globalOn": true
111+
},
112+
"pragmas-disable": {
113+
"globalOn": true
114+
},
115+
"pragmas-suggest": {
116+
"globalOn": true
117+
},
118+
"qualifyImportedNames": {
119+
"globalOn": true
120+
},
121+
"rename": {
122+
"config": {
123+
"crossModule": false
124+
},
125+
"globalOn": true
126+
},
127+
"retrie": {
128+
"globalOn": true
129+
},
130+
"semanticTokens": {
131+
"config": {
132+
"classMethodToken": "method",
133+
"classToken": "class",
134+
"dataConstructorToken": "enumMember",
135+
"functionToken": "function",
136+
"moduleToken": "namespace",
137+
"operatorToken": "operator",
138+
"patternSynonymToken": "macro",
139+
"recordFieldToken": "property",
140+
"typeConstructorToken": "enum",
141+
"typeFamilyToken": "interface",
142+
"typeSynonymToken": "type",
143+
"typeVariableToken": "typeParameter",
144+
"variableToken": "variable"
145+
},
146+
"globalOn": true
147+
},
148+
"splice": {
149+
"globalOn": true
150+
},
151+
"stan": {
152+
"globalOn": false
153+
}
154+
},
155+
"sessionLoading": "singleComponent"
156+
}

libs/saml2-web-sso/saml2-web-sso.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ library
9696
, errors >=2.3.0
9797
, exceptions >=0.10.3
9898
, extra >=1.6.18
99+
, file-path-th
99100
, filepath >=1.4.2.1
100101
, foundation >=0.0.25
101102
, ghc-prim >=0.5.3

libs/saml2-web-sso/src/SAML2/WebSSO/Test/Util/Misc.hs

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
module SAML2.WebSSO.Test.Util.Misc where
55

6-
import Control.Exception (ErrorCall (ErrorCall), throwIO)
76
import Control.Monad
87
import Control.Monad.IO.Class
98
import qualified Data.ByteString.Base64.Lazy as EL (encode)
@@ -20,8 +19,8 @@ import SAML2.WebSSO
2019
import Servant
2120
import Shelly (run, setStdin, shelly, silently)
2221
import System.Directory (doesFileExist)
23-
import System.Environment
2422
import System.FilePath
23+
import System.FilePath.TH
2524
import System.IO.Temp
2625
import System.Process (system)
2726
import Test.Hspec
@@ -59,34 +58,17 @@ rerenderFile fp = showFile fp >>= Prelude.writeFile (fp <> "-")
5958
hedgehog :: IO Bool -> Spec
6059
hedgehog = it "hedgehog tests" . (`shouldReturn` True)
6160

62-
-- | Helper function for generating new tests cases. This is probably dead code.
63-
haskellCodeFromXML :: forall a. (Typeable a, Show a, HasXMLRoot a) => Proxy a -> FilePath -> IO ()
64-
haskellCodeFromXML Proxy ifilepath_ = do
65-
root <- getEnv "SAML2_WEB_SSO_ROOT"
66-
let ifilepath = root </> "test/xml" </> ifilepath_
67-
ofilepath = root </> "test/Samples.hs"
68-
f :: String -> IO a
69-
f = either (throwIO . ErrorCall) pure . decode . cs
70-
g :: a -> String
71-
g = (<> mconcat aft) . (mconcat bef <>) . show
72-
where
73-
bef = ["\n\n", fnm, " :: ", show (typeRep (Proxy :: Proxy a)), "\n", fnm, " = "]
74-
aft = ["\n\n"]
75-
fnm = takeWhile (/= '.') $ fmap (\case '-' -> '_'; c -> c) ifilepath_
76-
typ <- f =<< Prelude.readFile ifilepath
77-
print (ifilepath, ofilepath)
78-
putStrLn . cs . encode $ typ
79-
Prelude.appendFile ofilepath $ g typ
80-
8161
readSampleIO :: (MonadIO m) => FilePath -> m LT
82-
readSampleIO fpath = liftIO $ do
83-
root <- getEnv "SAML2_WEB_SSO_ROOT"
84-
LT.readFile $ root </> "test/samples" </> fpath
62+
readSampleIO fpath =
63+
liftIO $
64+
LT.readFile $
65+
$(fileRelativeToProject "test/samples") </> fpath
8566

8667
doesSampleExistIO :: (MonadIO m) => FilePath -> m Bool
87-
doesSampleExistIO fpath = liftIO $ do
88-
root <- getEnv "SAML2_WEB_SSO_ROOT"
89-
doesFileExist $ root </> "test/samples" </> fpath
68+
doesSampleExistIO fpath =
69+
liftIO $
70+
doesFileExist $
71+
$(fileRelativeToProject "test/samples") </> fpath
9072

9173
roundtrip :: forall a. (Eq a, Show a, HasXMLRoot a) => Int -> IO LT -> a -> Spec
9274
roundtrip serial mkrendered parsed = describe ("roundtrip-" <> show serial) $ do

list_all_indices.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
curl -X GET -u elastic:changeme --cacert deploy/dockerephemeral/docker/elasticsearch-ca.pem "https://localhost:9200/_cat/indices?v"

migrate_index_local.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
echo 'username: elastic' > ~/tmp/credentials.yaml && \
6+
echo 'password: changeme' >> ~/tmp/credentials.yaml && \
7+
8+
cabal exec brig-index -- update-mapping --elasticsearch-index "$1" --elasticsearch-insecure-skip-tls-verify --elasticsearch-credentials ~/tmp/credentials.yaml

wire-server

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/nix/store/4zd058i4jbx6ib051rls1g7jnzs5li6g-all-local-packages

0 commit comments

Comments
 (0)