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 retries & update ping/go interop test #32

Merged
merged 12 commits into from
Aug 29, 2022
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
14 changes: 12 additions & 2 deletions .github/actions/setup-testground/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
go-version: "1.16.x"

- name: Install testground
run: make install
run: make install || make install || make install || make install
working-directory: testground
shell: bash

Expand All @@ -38,4 +38,14 @@ runs:
task_timeout_min = 60
EOF
testground daemon > testground.out 2> testground.err &
fi;
fi;

- name: Check testground daemon health
run:
echo "Waiting for Testground to launch on 8042...";
while ! nc -z localhost 8042; do
sleep 1;
done;
echo "Testground launched";
testground healthcheck --runner local:docker --fix;
shell: bash
4 changes: 4 additions & 0 deletions .github/workflows/ping-interop-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:
required: false
description: repository to use as replace target
default: github.com/libp2p/go-libp2p
push:
pull_request:

name: go-libp2p ping - go test with testground.

Expand All @@ -28,3 +30,5 @@ jobs:
custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p"
custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git branch
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
test_repository: ${{ (github.event.inputs && '') || github.repository }}
test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }}
35 changes: 35 additions & 0 deletions .github/workflows/ping-interop-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
workflow_dispatch:
inputs:
testground_endpoint:
type: string
required: false
description: testground endpoint
custom_git_reference:
description: the git commit or branch we're going to use for the custom target
required: false
type: string
custom_git_target:
description: the custom git fork url we're going to use for the custom target (github.com/some-fork/rust-libp2p)
required: false
type: string
custom_interop_target:
description: in the case of cross-implementation testing, the implementation target (go | rust | ...)
required: false
type: string
push:
pull_request:

name: libp2p ping - go + rust test (latest) with testground.

jobs:
run-ping-latest:
uses: "./.github/workflows/run-composition.yml"
with:
composition_file: "ping/_compositions/go-rust-interop-latest.toml"
custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p"
custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference
custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
test_repository: ${{ (github.event.inputs && '') || github.repository }}
test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }}
4 changes: 4 additions & 0 deletions .github/workflows/ping-interop-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:
required: false
description: repository to use as replace target
default: github.com/libp2p/rust-libp2p
push:
pull_request:

name: rust-libp2p ping - rust test with testground.

Expand All @@ -28,3 +30,5 @@ jobs:
custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p"
custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
test_repository: ${{ (github.event.inputs && '') || github.repository }}
test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }}
10 changes: 8 additions & 2 deletions .github/workflows/ping-interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ on:
description: in the case of cross-implementation testing, the implementation target (go | rust | ...)
required: false
type: string
push:
pull_request:

name: libp2p ping - go and rust test with testground.
name: libp2p ping - go and rust test (all) with testground.

jobs:
run-ping-latest:
Expand All @@ -29,11 +31,15 @@ jobs:
custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference
custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
test_repository: ${{ (github.event.inputs && '') || github.repository }}
test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }}
run-ping-all:
uses: "./.github/workflows/run-composition.yml"
with:
composition_file: "ping/_compositions/go-rust-interop.toml"
custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p"
custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference
custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
test_repository: ${{ (github.event.inputs && '') || github.repository }}
test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }}
24 changes: 18 additions & 6 deletions .github/workflows/run-composition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ on:
testground_endpoint:
required: false
type: string
test_repository:
required: false
type: string
test_ref:
required: false
type: string
jobs:
run_test:
name: Run a test with different versions
runs-on: ubuntu-latest
env:
TEST_PLAN_REPO: "libp2p/test-plans"
TEST_PLAN_BRANCH: "master"
TEST_PLAN_REPO: ${{ inputs.test_repository || 'libp2p/test-plans' }}
TEST_PLAN_BRANCH: ${{ inputs.test_ref || 'master' }}
TESTGROUND_ENDPOINT: ${{ inputs.testground_endpoint }}
defaults:
run:
Expand Down Expand Up @@ -56,17 +62,23 @@ jobs:
echo "::set-output name=custom_git_sha::${SHA}"
- name: Build the composition file
working-directory: ./test-plans
timeout-minutes: 30
run: |
testground build composition \
-f ${{ inputs.composition_file }} \
--wait
for i in 1 2 3; do
echo "=== Attempt $i ==="
testground build composition \
-f ${{ inputs.composition_file }} \
--wait && exit 0;
sleep 10
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to sleep in between retries?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The retry might happen almost instantaneously because of the docker caching. The goal here is to wait some time to give remote services a chance to improve the situation (like the 404 above).

I'll merge as is, but there will be at least one follow-up PR for improvements, where we can remove this sleep if we don't want it.

done
exit 1
env:
GitReference: ${{ steps.resolve_reference.outputs.custom_git_sha || inputs.custom_git_reference }}
GitTarget: ${{ inputs.custom_git_target }}
InteropTarget: ${{ inputs.custom_interop_target }}
- name: Run the composition file
working-directory: ./test-plans
timeout-minutes: 10
timeout-minutes: 6
run: |
testground run composition \
-f ${{ inputs.composition_file }} \
Expand Down
46 changes: 26 additions & 20 deletions ping/_compositions/go.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
[master]
GoVersion = '1.18'
Modfile = "go.v0.21.mod"
Selector = 'v0.21'
Modfile = "go.v0.22.mod"
Selector = 'v0.22'

[custom]
GoVersion = '1.18'
Modfile = "go.v0.21.mod"
Selector = 'v0.21'
Modfile = "go.v0.22.mod"
Selector = 'v0.22'

[[groups]]
Id = "v0.11"
GoVersion = '1.14'
Modfile = "go.v0.11.mod"
Selector = 'v0.11'
Id = "v0.22"
GoVersion = '1.18'
Modfile = "go.v0.22.mod"
Selector = 'v0.22'

[[groups]]
Id = "v0.17"
GoVersion = '1.16'
Modfile = "go.v0.17.mod"
Selector = 'v0.17'
Id = "v0.21"
GoVersion = '1.18'
Modfile = "go.v0.21.mod"
Selector = 'v0.21'

[[groups]]
Id = "v0.20"
GoVersion = '1.18'
Modfile = "go.v0.20.mod"
Selector = 'v0.20'

[[groups]]
Id = "v0.19"
Expand All @@ -27,13 +33,13 @@ Modfile = "go.v0.19.mod"
Selector = 'v0.19'

[[groups]]
Id = "v0.20"
GoVersion = '1.18'
Modfile = "go.v0.20.mod"
Selector = 'v0.20'
Id = "v0.17"
GoVersion = '1.16'
Modfile = "go.v0.17.mod"
Selector = 'v0.17'

[[groups]]
Id = "v0.21"
GoVersion = '1.18'
Modfile = "go.v0.21.mod"
Selector = 'v0.21'
Id = "v0.11"
GoVersion = '1.14'
Modfile = "go.v0.11.mod"
Selector = 'v0.11'
22 changes: 13 additions & 9 deletions ping/_compositions/rust.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
[[groups]]
Id = "v0.44.0"
CargoFeatures = 'libp2pv0440'
[master]
CargoFeatures = 'libp2pv0480'

[custom]
CargoFeatures = 'libp2pv0480'

[[groups]]
Id = "v0.45.1"
CargoFeatures = 'libp2pv0450'
Id = "v0.47.0"
CargoFeatures = 'libp2pv0470'

[[groups]]
Id = "v0.46.0"
CargoFeatures = 'libp2pv0460'

[master]
CargoFeatures = 'libp2pv0470'
[[groups]]
Id = "v0.45.1"
CargoFeatures = 'libp2pv0450'

[custom]
CargoFeatures = 'libp2pv0470'
[[groups]]
Id = "v0.44.0"
CargoFeatures = 'libp2pv0440'
3 changes: 3 additions & 0 deletions ping/go/compat/libp2p.v0.11.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import (

"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/config"

noise "github.com/libp2p/go-libp2p-noise"
tls "github.com/libp2p/go-libp2p-tls"
)

type PeerAddrInfo = peer.AddrInfo

func NewLibp2(ctx context.Context, secureChannel string, opts ...config.Option) (host.Host, error) {
security := getSecurityByName(secureChannel)

Expand Down
3 changes: 3 additions & 0 deletions ping/go/compat/libp2p.v0.17.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import (

"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/config"

noise "github.com/libp2p/go-libp2p-noise"
tls "github.com/libp2p/go-libp2p-tls"
)

type PeerAddrInfo = peer.AddrInfo

func NewLibp2(ctx context.Context, secureChannel string, opts ...config.Option) (host.Host, error) {
security := getSecurityByName(secureChannel)

Expand Down
3 changes: 3 additions & 0 deletions ping/go/compat/libp2p.v0.20.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import (

"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/config"

noise "github.com/libp2p/go-libp2p/p2p/security/noise"
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
)

type PeerAddrInfo = peer.AddrInfo

func NewLibp2(ctx context.Context, secureChannel string, opts ...config.Option) (host.Host, error) {
security := getSecurityByName(secureChannel)

Expand Down
37 changes: 37 additions & 0 deletions ping/go/compat/libp2p.v0.22.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//go:build v0.22
// +build v0.22

package compat

import (
"context"
"fmt"

"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/config"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"

noise "github.com/libp2p/go-libp2p/p2p/security/noise"
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
)

type PeerAddrInfo = peer.AddrInfo

func NewLibp2(ctx context.Context, secureChannel string, opts ...config.Option) (host.Host, error) {
security := getSecurityByName(secureChannel)

return libp2p.New(
append(opts, security)...,
)
}

func getSecurityByName(secureChannel string) libp2p.Option {
switch secureChannel {
case "noise":
return libp2p.Security(noise.ID, noise.New)
case "tls":
return libp2p.Security(tls.ID, tls.New)
}
panic(fmt.Sprintf("unknown secure channel: %s", secureChannel))
}
Loading