Skip to content

Commit

Permalink
Merge pull request #7 from networkservicemesh/cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
haiodo authored Jan 19, 2021
2 parents cb09d9d + 1061fdc commit 1ee7186
Show file tree
Hide file tree
Showing 24 changed files with 551 additions and 45 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions .cloudtest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
version: 1.0
root: "./.tests/cloud_test/"
timeout: 7200 # 2 hour total total timeout
shuffle-enabled: true
statistics:
enabled: true
interval: 60 # 60 seconds for statistics
import:
- cloudtest/packet.yaml
- cloudtest/tests.yaml

retest: # Allow to do test re-run if some kind of failures are detected, line CNI network plugin errors.
count: 1 # Allow 5 times to do restart
warmup-time: 15 # Put 15 seconds warmup for cluster instance to be used again.
allowed-retests: 2 # If cluster instance have few attempts with retest requests one after another, we need to restart cluster.
pattern:
- "NetworkPlugin cni failed to set up pod" # Error in AWS dur to leak of IPs or not ability to assign them.
- "etcdserver: request timed out" # Error in any could, reason unknown.
- "unable to establish connection to VPP (VPP API socket file /run/vpp/api.sock does not exist)" # a VPP is not started, it will be re-started in general, but will cause test fail.
# Sometimes (rarely) docker registry is unavailable for a moment
- "Error response from daemon: Get https://.*docker.io/.*: dial tcp: lookup registry"
- "Error response from daemon: Get https://.*docker.io/.*: net/http: request canceled while waiting for connection"
- "Failed create pod sandbox"
reporting:
junit-report: "results/junit.xml"
health-check:
- message: "Branch is not up to date"
interval: 60 # 1 minute
run: |
echo "Health check!"
109 changes: 92 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: ci
on: pull_request
on:
pull_request:
branches:
- master
jobs:
yamllint:
name: yamllint
Expand All @@ -11,25 +14,30 @@ jobs:
- name: yaml-lint
uses: ibiqlik/action-yamllint@v1
with:
config_file: .yamllint.yml
config_file: .ci/yamllint.yml
strict: true

shellcheck:
name: shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: shellcheck
uses: fkautz/shell-linter@v1.0.1

golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.31
version: v1.35

excludeFmtErrorf:
name: exclude fmt.Errorf
runs-on: ubuntu-latest
Expand All @@ -41,6 +49,7 @@ jobs:
echo "Please use errors.Errorf (or errors.New or errors.Wrap or errors.Wrapf) as appropriate rather than fmt.Errorf"
exit 1
fi
checkgomod:
name: check go.mod and go.sum
runs-on: ubuntu-latest
Expand All @@ -54,24 +63,90 @@ jobs:
run: |
git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false )
git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false )
gogenerate:
name: Check generated files
automerge:
name: automerge
runs-on: ubuntu-latest
needs:
- packet
if: github.actor == 'nsmbot'
steps:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@master
- name: Check out the code
uses: actions/checkout@v2
- name: Fetch master
run: |
git remote -v
git fetch --depth=1 origin master
- name: Only allow go.mod and go.sum changes
run: |
find . -type f ! -name 'go.mod' ! -name 'go.sum' -exec git diff --exit-code origin/master -- {} +
- name: Automerge nsmbot PR
uses: ridedott/merge-me-action@master
with:
GITHUB_LOGIN: nsmbot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

packet:
name: packet
runs-on: ubuntu-latest
steps:
- name: Set up kubectl # 1. Set up kubectl
uses: azure/setup-kubectl@v1
- name: Set up /bin permissions # 2. Set up /bin permissions
run: |
sudo chmod -R 777 /bin
- name: Set up go # 3. Set up go
uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Install cloudtest # 4. Install cloudtest
run: |
go get github.com/networkservicemesh/cloudtest@master
env:
GO111MODULE: on
GOBIN: /bin
- name: Checkout deployments # 5. Checkout deployments
uses: actions/checkout@v2
with:
repository: networkservicemesh/deployments-k8s
path: networkservicemesh/deployments-k8s
- name: Checkout files # 6. Checkout files
uses: actions/checkout@v2
with:
version: '3.8.0'
path: ${{ github.repository }}
- name: Run tests with cloudtest # 7. Run tests with cloudtest
working-directory: ${{ github.repository }}
run: |
cloudtest
env:
PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}
PACKET_PROJECT_ID: 383890d0-f5d1-4de1-881a-4d1ede549d18
- name: Upload logs # 8. Upload logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: logs-${{ github.run_number }}
path: ${{ github.repository }}/.tests/cloud_test/

packet-cleanup:
name: packet cleanup
runs-on: ubuntu-latest
needs:
- packet
if: ${{ always() }}
steps:
- name: Set up /bin permissions
run: |
sudo chmod -R 777 /bin
- uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Install proto-gen-go
run: go get -u github.com/golang/protobuf/protoc-gen-go@v1.3.3
- name: Install proto-gen-go
run: go get github.com/searKing/golang/tools/cmd/go-syncmap
- name: Generate files
run: go generate ./...
- name: Check for changes in generated code
- name: Clean up packet
run: |
git diff -- '*.pb.go' || ( echo "Rerun go generate ./... locally and resubmit" && false )
git diff -- '*.gen.go' || ( echo "Rerun go generate ./... locally and resubmit" && false )
go get github.com/networkservicemesh/cloudtest/pkg/providers/packet/packet_cleanup@master
packet_cleanup -k y -c y
env:
GO111MODULE: on
GOBIN: /bin
PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}
PACKET_PROJECT_ID: 383890d0-f5d1-4de1-881a-4d1ede549d18
23 changes: 23 additions & 0 deletions .github/workflows/pr-for-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Pull Request on update/* Branch Push
on:
push:
branches:
- update/**
jobs:
auto-pull-request:
name: Pull Request on update/* Branch Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Construct PR message
run: |
PULL_REQUEST_BODY=$(git log -1)
echo ${PULL_REQUEST_BODY}
echo PULL_REQUEST_BODY=${PULL_REQUEST_BODY} >> $GITHUB_ENV
- name: pull-request-action
uses: vsoch/pull-request-action@1.0.12
env:
GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
BRANCH_PREFIX: "update/"
PULL_REQUEST_BRANCH: "master"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
# Goland files
.idea
9 changes: 3 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ run:
tests: true
linters-settings:
goheader:
template-path: "./.license/template.txt"
template-path: "./.ci/license/template.txt"
values:
const:
year: 2020
regexp:
year-range: ((\d\d\d\d-{{year}})|({{year}}))
company: .*
copyright-holder: Copyright \(c\) {{year-range}} {{company}}\n\n
copyright-holder: Copyright \(c\) ({{year-range}}) {{company}}\n\n
copyright-holders: ({{copyright-holder}})+
errcheck:
check-type-assertions: false
Expand All @@ -30,7 +27,7 @@ linters-settings:
golint:
min-confidence: 0.8
goimports:
local-prefixes: github.com/networkservicemesh/integration-k8s-kind
local-prefixes: github.com/networkservicemesh
gocyclo:
min-complexity: 15
maligned:
Expand Down
50 changes: 50 additions & 0 deletions cloudtest/packet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
version: 1.0
providers:
- name: "packet"
kind: "packet"
instances: 1
retry: 5
node-count: 2
enabled: true
timeout: 2400 # 40 minutes to start cluster
env:
- CLUSTER_RULES_PREFIX=null # To not add any specific code
- KUBECONFIG=$(tempdir)/config
- CLUSTER_NAME=$(cluster-name)-$(date)-${GITHUB_RUN_NUMBER}-$(rands10)
env-check:
- PACKET_AUTH_TOKEN
- PACKET_PROJECT_ID
- GITHUB_RUN_NUMBER
packet:
ssh-key: sshkey.pub # A key name relative to $(tempdir) or absolute
hardware-devices:
- name: "Master"
host-name: "SR-IOV-Master-${CLUSTER_NAME}"
os: "ubuntu_20_04"
billing-cycle: "hourly"
network:
type: "hybrid"
port-vlans:
eth3: 1044
- name: "Worker"
host-name: "SR-IOV-Worker-${CLUSTER_NAME}"
os: "ubuntu_20_04"
billing-cycle: "hourly"
network:
type: "hybrid"
port-vlans:
eth3: 1044
hardware-reservations:
- 2cf78481-53b0-46c8-a084-6e9815acdb0b
- 2361d3c2-f694-4fa7-a683-a9f69e2abe7c
- 70b51e39-2e65-4a64-8191-dd28386c0b80
- 4f27da36-a911-45a5-ab81-0e789348e3fe
- 7741d4a8-8555-492b-8d73-63c2f0715d16
- d173dbde-8510-454e-b0c2-c120c397cdf5
scripts:
install: "echo all deps installed"
setup: |
ssh-keygen -t rsa -f $(tempdir)/sshkey -q -N ""
/bin/bash -c "eval `ssh-agent -s`; ssh-add $(tempdir)/sshkey"
start: scripts/create-kubernetes-cluster.sh $(device.Master.pub.ip.4) $(device.Worker.pub.ip.4) "$(tempdir)/sshkey"
12 changes: 12 additions & 0 deletions cloudtest/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
executions:
- name: "tests"
env:
- ARTIFACTS_ARCHIVE=true
root: ./
timeout: 3600
cluster-count: 1
cluster-selector:
- packet
cluster-env:
- KUBECONFIG
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/networkservicemesh/integration-k8s-packet

go 1.15

require github.com/stretchr/testify v1.6.1
require (
github.com/networkservicemesh/integration-tests v0.0.0-20210118101415-f3ff2f1cf440
github.com/stretchr/testify v1.6.1
)
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/networkservicemesh/gotestmd v0.0.0-20210111062812-8d2731581948 h1:mbLtWfNF7lln3ewfjIqcy1L7yXOXdlfFsM/qu33awo8=
github.com/networkservicemesh/gotestmd v0.0.0-20210111062812-8d2731581948/go.mod h1:RsxZNZRDhTSkY21gzrJVC4ufT10bfeHRvrRTtypUx+k=
github.com/networkservicemesh/integration-tests v0.0.0-20210118101415-f3ff2f1cf440 h1:2B76RMBtkM3eUc03qrp3d+zkM9Xp/63DjZ2HQwSkWn4=
github.com/networkservicemesh/integration-tests v0.0.0-20210118101415-f3ff2f1cf440/go.mod h1:3FacL1gEYKhPfEHBi3Lr4zYUzIqe3BYzHZo0+nbDjmg=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78 h1:nVuTkr9L6Bq62qpUqKo/RnZCFfzDBL0bYo6w9OJUqZY=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
Expand Down
26 changes: 6 additions & 20 deletions basic_suite_test.go → main_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020 Doc.ai and/or its affiliates.
// Copyright (c) 2020-2021 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -14,30 +14,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package integration_k8s_kind_test
package main_test

import (
"testing"

"github.com/stretchr/testify/suite"
)

type BasicTestsSuite struct {
suite.Suite
}

func (s *BasicTestsSuite) SetupSuite() {

}

func (s *BasicTestsSuite) TearDownSuite() {

}

func (s *BasicTestsSuite) TearDownTest() {

}
"github.com/networkservicemesh/integration-tests/suites/sriov"
)

func TestRunBasicSuite(t *testing.T) {
suite.Run(t, &BasicTestsSuite{})
func TestSRIOV(t *testing.T) {
suite.Run(t, new(sriov.Suite))
}
Loading

0 comments on commit 1ee7186

Please sign in to comment.