mirror of
https://github.com/status-im/libp2p-test-plans.git
synced 2025-02-20 02:28:11 +00:00
Working interop
This commit is contained in:
parent
4d55f50126
commit
c8e4b3227e
109
ping/_compositions/all-interop-latest.toml
Normal file
109
ping/_compositions/all-interop-latest.toml
Normal file
@ -0,0 +1,109 @@
|
||||
[metadata]
|
||||
name = "go-rust-cross-version-{{ or $.Env.InteropTarget "-" }}-{{ or $.Env.GitReference "" }}"
|
||||
|
||||
[global]
|
||||
plan = "libp2p/ping"
|
||||
case = "ping"
|
||||
runner = "local:docker"
|
||||
concurrent_builds = 1
|
||||
|
||||
[global.build_config]
|
||||
enable_go_build_cache = false # see https://github.com/testground/testground/issues/1361
|
||||
# disable testground's goproxy which hangs on github runners.
|
||||
go_proxy_mode = "remote"
|
||||
go_proxy_url = "https://proxy.golang.org"
|
||||
|
||||
{{ with (load_resource "./go.toml") }}
|
||||
{{ with (index .groups 0) }}
|
||||
[[groups]]
|
||||
id = "go-latest-{{ .Id }}"
|
||||
instances = { count = 1 }
|
||||
builder = "docker:go"
|
||||
|
||||
[groups.build]
|
||||
selectors = ['{{ .Selector }}']
|
||||
|
||||
[groups.build_config]
|
||||
path = "./go/"
|
||||
build_base_image = 'golang:{{ .GoVersion }}-buster'
|
||||
modfile = "{{ .Modfile }}"
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $.Env.InteropTarget "go" }}
|
||||
{{ if $.Env.GitReference }}
|
||||
{{ with .custom }}
|
||||
[[groups]]
|
||||
id = "go-custom-{{ $.Env.GitReference }}"
|
||||
instances = { count = 1 }
|
||||
builder = "docker:go"
|
||||
|
||||
[groups.build]
|
||||
selectors = ['{{ .Selector }}']
|
||||
|
||||
[[groups.build.dependencies]]
|
||||
module = "github.com/libp2p/go-libp2p"
|
||||
version = "{{ $.Env.GitReference }}"
|
||||
{{ if $.Env.GitTarget }}
|
||||
target = "{{ $.Env.GitTarget }}"
|
||||
{{ end }}
|
||||
|
||||
[groups.build_config]
|
||||
path = "./go/"
|
||||
build_base_image = 'golang:{{ .GoVersion }}-buster'
|
||||
modfile = "{{ .Modfile }}"
|
||||
|
||||
[groups.build_config.dockerfile_extensions]
|
||||
# deal with dependency changes in master until we create the new vx.y.z instance
|
||||
pre_build = """
|
||||
RUN cd ${PLAN_DIR} && \
|
||||
go mod download github.com/libp2p/go-libp2p && \
|
||||
go mod tidy -compat={{ .GoVersion }}
|
||||
"""
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with (load_resource "./rust.toml") }}
|
||||
{{ with (index .groups 0) }}
|
||||
[[groups]]
|
||||
id = "rust-latest-{{ .Id }}"
|
||||
instances = { count = 1 }
|
||||
builder = "docker:generic"
|
||||
|
||||
[groups.build_config]
|
||||
path = "./rust/"
|
||||
|
||||
[groups.build_config.build_args]
|
||||
CARGO_FEATURES = '{{ .CargoFeatures }}'
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $.Env.InteropTarget "rust" }}
|
||||
{{ if $.Env.GitReference }}
|
||||
{{ with .custom }}
|
||||
[[groups]]
|
||||
id = "rust-custom-{{ $.Env.GitReference }}"
|
||||
instances = { count = 1 }
|
||||
builder = "docker:generic"
|
||||
|
||||
[groups.build_config]
|
||||
path = "./rust/"
|
||||
|
||||
[groups.build_config.build_args]
|
||||
CARGO_FEATURES = '{{ .CargoFeatures }}'
|
||||
CARGO_REMOVE = '{{ .CargoFeatures }}'
|
||||
CARGO_PATCH = """
|
||||
{{ .CargoFeatures }} = {package = "libp2p", git = "https://{{ or $.Env.GitTarget "github.com/libp2p/rust-libp2p" }}", rev = "{{ $.Env.GitReference }}", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "async-std", "rsa" ], optional = true}
|
||||
"""
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
[[groups]]
|
||||
id = "nim-latest"
|
||||
instances = { count = 1 }
|
||||
builder = "docker:generic"
|
||||
|
||||
[groups.build_config]
|
||||
path = "./nim/"
|
@ -1,10 +1,11 @@
|
||||
FROM nimlang/nim:alpine as builder
|
||||
|
||||
RUN nimble install -y "https://github.com/status-im/testground-nim-sdk@#9fba8111179c2ace7a2b595d8ed8cb10f0bf9c21"
|
||||
RUN nimble install -y "https://github.com/status-im/testground-nim-sdk@#c282ff68c08ef85a7ca011e077e3e69eb1a6edec"
|
||||
RUN nimble install -y "libp2p"
|
||||
FROM builder
|
||||
|
||||
COPY . .
|
||||
ARG PLAN_PATH="./"
|
||||
COPY ./plan/${PLAN_PATH} ./plan
|
||||
RUN cd plan && nimble install -dy && nim c -d:chronicles_log_level=NOTICE main.nim
|
||||
|
||||
ENTRYPOINT ["plan/main"]
|
||||
|
@ -5,19 +5,29 @@ import sequtils
|
||||
|
||||
type
|
||||
PeerData = object
|
||||
id: string
|
||||
addrs: seq[string]
|
||||
id {.serializedFieldName: "ID".}: string
|
||||
addrs {.serializedFieldName: "Addrs".}: seq[string]
|
||||
|
||||
testground(client):
|
||||
let addresses = getInterfaces().filterIt(it.name == "eth1").mapIt(it.addresses)
|
||||
if addresses.len < 1 or addresses[0].len < 1:
|
||||
quit "Can't find local ip!"
|
||||
|
||||
discard await client.signal("initialized_global")
|
||||
|
||||
let
|
||||
maxLatency = client.param(int, "max_latency_ms")
|
||||
rng = libp2p.newRng()
|
||||
address = addresses[0][0].host
|
||||
switch = newStandardSwitch(addrs = MultiAddress.init(address).tryGet(), rng = rng)
|
||||
switch =
|
||||
SwitchBuilder
|
||||
.new()
|
||||
.withAddress(MultiAddress.init(address).tryGet())
|
||||
.withRng(rng)
|
||||
.withYamux()
|
||||
.withTcpTransport()
|
||||
.withNoise()
|
||||
.build()
|
||||
pingProtocol = Ping.new(rng = rng)
|
||||
|
||||
switch.mount(pingProtocol)
|
||||
|
Loading…
x
Reference in New Issue
Block a user