Skip to content

Commit

Permalink
WIP: Infrastructure for gRPC interop test
Browse files Browse the repository at this point in the history
  • Loading branch information
edsko committed Jan 24, 2024
1 parent 7645559 commit 1dca7d7
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ packages: .

package grapesy
tests: True
flags: +build-demo +build-stress-test
flags: +build-demo +build-stress-test +build-interop
2 changes: 1 addition & 1 deletion cabal.project.ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ packages: .

package grapesy
tests: True
flags: +build-demo +build-stress-test
flags: +build-demo +build-stress-test +build-interop
ghc-options: -Werror
19 changes: 19 additions & 0 deletions dev/disable-ipv6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

##
## Disable IPv6 for Docker
##
## The gRPC interop tests get confused if IPv6 is enabled: they only expect an
## IPv4 port to be listed by `docker port`, and throw a parse error when there
## is also an IPv6 port. Disabling IPv6 in `/etc/docker/daemon.json` instead
## would be cleaner but does not seem to have the desired effect.
##

# Disable IPv6 on the host
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

# Restart docker
systemctl restart docker


8 changes: 8 additions & 0 deletions dev/grapesy-deps-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM haskell:9.2.8
RUN mkdir /var/local/git
RUN git clone https://github.com/well-typed/grapesy.git /var/local/git/grapesy
WORKDIR /var/local/git/grapesy
RUN cabal update -w /opt/ghc/9.2.8/bin/ghc
RUN cabal build -w /opt/ghc/9.2.8/bin/ghc all --only-dependencies
WORKDIR /
RUN rm -rf /var/local/git/grapesy
15 changes: 15 additions & 0 deletions dev/reset-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

##
## Reset the entire Docker state
##
## Don't use this is you are not sure if you might still need any docker
## images, containers, volumes or networks!
##

if [ "$(docker ps -q)" ]
then
docker kill $(docker ps -q)
fi

docker system prune -f --volumes
22 changes: 22 additions & 0 deletions grapesy.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,22 @@ executable test-stress
buildable:
False

executable grapesy-interop
import:
lang
hs-source-dirs:
interop
main-is:
Main.hs
build-depends:
, grapesy
build-depends:
, base

if !flag(build-interop)
buildable:
False

Flag build-demo
description: Build the demo
default: False
Expand All @@ -396,7 +412,13 @@ Flag build-stress-test
default: False
manual: True

Flag build-interop
description: Build the gRPC interop test executable
default: False
manual: True

Flag crypton
description: Use the crypton-x509-* package family instead of x509-*
default: True
manual: False

8 changes: 8 additions & 0 deletions interop/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Main where

import System.Environment

main :: IO ()
main = do
args <- getArgs
putStrLn $ "grapesy interop " ++ show args

0 comments on commit 1dca7d7

Please sign in to comment.