Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add nim hole punching tests #322

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 15 additions & 7 deletions hole-punch-interop/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
RUST_SUBDIRS := $(wildcard impl/rust/*/.)
GO_SUBDIRS := $(wildcard impl/go/*/.)
NIM_SUBDIRS := $(wildcard impl/nim/*/.)

# Combine all sub-directory lists into a single list
ALL_SUBDIRS := $(RUST_SUBDIRS) $(GO_SUBDIRS) $(NIM_SUBDIRS)

all: rust-relay router $(ALL_SUBDIRS)

all: rust-relay router $(RUST_SUBDIRS) $(GO_SUBDIRS)
rust-relay:
$(MAKE) -C rust-relay

router:
$(MAKE) -C router
$(RUST_SUBDIRS):
$(MAKE) -C $@
$(GO_SUBDIRS):

$(ALL_SUBDIRS):
$(MAKE) -C $@

clean:
$(MAKE) -C rust-relay clean
$(MAKE) -C router clean
$(MAKE) -C $(RUST_SUBDIRS) clean
$(MAKE) -C $(GO_SUBDIRS) clean
for dir in $(ALL_SUBDIRS); do \
$(MAKE) -C $$dir clean; \
done

.PHONY: rust-relay router all $(ALL_SUBDIRS)

.PHONY: rust-relay router all $(RUST_SUBDIRS) $(GO_SUBDIRS)
6 changes: 6 additions & 0 deletions hole-punch-interop/impl/nim/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nim-libp2p-*.zip
nim-libp2p-*
nim-libp2p
nim-libp2p-*/*
image.json
hole_punching.nim
21 changes: 21 additions & 0 deletions hole-punch-interop/impl/nim/v1.1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
image_name := nim-v1.1
commitSha := 93925ac28b04cd94d06a332412973e90f80f35df
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can see, this is a commit that is not yet merged into master, correct? I am okay with that, assuming it will eventually be updated to one that sits on master, ideally even one that points at a particular release.

Given that you are adding the workflow in vacp2p/nim-libp2p#998, I'd suggest it is save to merge that PR first, given that it essentially tests the exact same version as what is referenced here.

Once that is merged into your master, we can update this commit hash here and merge this PR.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, thanks.


all: image.json

image.json: nim-libp2p-${commitSha}
cd nim-libp2p-${commitSha} && IMAGE_NAME=${image_name} ../../../../dockerBuildWrapper.sh -f tests/hole-punching-interop/Dockerfile .
docker image inspect ${image_name} -f "{{.Id}}" | \
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@

nim-libp2p-${commitSha}: nim-libp2p-${commitSha}.zip
unzip -o nim-libp2p-${commitSha}.zip

nim-libp2p-${commitSha}.zip:
wget -O $@ "https://github.com/status-im/nim-libp2p/archive/${commitSha}.zip"

clean:
rm -f image.json
rm -rf nim-libp2p*

.PHONY: all clean
4 changes: 2 additions & 2 deletions hole-punch-interop/impl/rust/v0.53/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ rust-libp2p-${commitSha}.zip:
wget -O $@ "https://github.com/libp2p/rust-libp2p/archive/${commitSha}.zip"

clean:
rm image.json
rm rust-libp2p-*.zip
rm -f image.json
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
rm -f rust-libp2p-*.zip
rm -rf rust-libp2p-*
2 changes: 1 addition & 1 deletion hole-punch-interop/router/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ image.json: Dockerfile run.sh
docker image inspect ${image_name} -f "{{.Id}}" | \
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
clean:
rm image.json
rm -f image.json
2 changes: 1 addition & 1 deletion hole-punch-interop/rust-relay/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ image.json: Cargo.lock src/** Dockerfile
docker image inspect ${image_name} -f "{{.Id}}" | \
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
clean:
rm image.json
rm -f image.json
4 changes: 4 additions & 0 deletions hole-punch-interop/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export const versions: Array<Version> = [
id: "rust-v0.53",
transports: ["tcp", "quic"]
} as Version,
{
id: "nim-v1.1",
transports: ["tcp"],
},
].map((v: Version) => (typeof v.containerImageID === "undefined" ? ({ ...v, containerImageID: readImageId(canonicalImagePath(v.id)) }) : v))

function readImageId(path: string): string {
Expand Down