Skip to content

Commit

Permalink
Split tests into client tests and provider tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gfenn-newbury committed Dec 21, 2021
1 parent 60139e0 commit f915beb
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 12 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/client_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Go Client Tests
on:
push:
branches:
- main
- release/*
pull_request:
branches:
- main
- release/*
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
experimental: [false]
go: ["1.16"]
os: [ubuntu-latest]
# Test against RouterOS v7
routeros_version:
- "7.1"
legacy_bgp_support: [true]

steps:
- name: Set up Go
uses: actions/setup-go@v2.1.3
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2.3.4

- name: Get dependencies
run: |
go mod download
- name: Build
run: go build -v .

- name: Set up RouterOS
run: |
sudo pip3 install routeros_api
python3 .github/scripts/setup_routeros.py
env:
ROS_USERNAME: admin
ROS_PASSWORD: ''
ROS_IP_ADDRESS: 127.0.0.1

- name: Run client tests
run: go test ./client
env:
ROS_HOSTURL: https://127.0.0.1
ROS_USERNAME: admin
ROS_PASSWORD: ''
ROS_INSECURE: true
TF_ACC: 1
LEGACY_BGP_SUPPORT: ${{ matrix.legacy_bgp_support }}

services:
routeros:
image: gnewbury/routeros:${{ matrix.routeros_version }}
ports:
- 443:443
- 8728:8728
volumes:
- /dev/net/tun:/dev/net/tun
options: >-
--cap-add=NET_ADMIN
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Terraform Provider Tests
on:
push:
branches:
Expand Down Expand Up @@ -49,16 +49,6 @@ jobs:
ROS_PASSWORD: ''
ROS_IP_ADDRESS: 127.0.0.1

- name: Run client tests
run: go test ./client
env:
ROS_HOSTURL: https://127.0.0.1
ROS_USERNAME: admin
ROS_PASSWORD: ''
ROS_INSECURE: true
TF_ACC: 1
LEGACY_BGP_SUPPORT: ${{ matrix.legacy_bgp_support }}

- name: Run provider tests
run: go test ./routeros
env:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Terraform Provider RouterOS

![testing workflow](https://github.com/gnewbury1/terraform-provider-routeros/actions/workflows/test.yml/badge.svg?branch=main)
![client testing workflow](https://github.com/gnewbury1/terraform-provider-routeros/actions/workflows/client_tests.yml/badge.svg?branch=main)
![provider testing workflow](https://github.com/gnewbury1/terraform-provider-routeros/actions/workflows/provider_tests.yml/badge.svg?branch=main)

## Purpose

Expand Down

0 comments on commit f915beb

Please sign in to comment.