Skip to content

Commit

Permalink
Test: Add smoke test suite and workflow (#342)
Browse files Browse the repository at this point in the history
* Add smoke test suite

* add workflow_dispatch and changed branch to main for linodego

* Update .github/workflows/nightly-smoke-tests.yml

Co-authored-by: Zhiwei Liang <[email protected]>

---------

Co-authored-by: Zhiwei Liang <[email protected]>
  • Loading branch information
ykim-akamai and zliang-akamai authored Jul 6, 2023
1 parent a889f87 commit 3a8b8eb
Show file tree
Hide file tree
Showing 20 changed files with 157 additions and 25 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Nightly Smoke Tests

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
smoke_tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main

- name: Checkout code
uses: actions/setup-go@v4
with:
go-version: 'stable'

- run: go version

- name: Run smoke tests
run: make smoketest
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ testunit:
testint:
cd test && make test

smoketest:
cd test && make smoketest

build: vet lint
go build ./...
cd k8s && go build ./...
Expand Down
100 changes: 96 additions & 4 deletions go.work.sum

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@ test:
LINODE_API_VERSION="v4beta" \
GO111MODULE="on" \
go test -v ./integration $(ARGS)

.PHONY: smoketest

smoketest:
@LINODE_FIXTURE_MODE="play" \
LINODE_TOKEN="awesometokenawesometokenawesometoken" \
LINODE_API_VERSION="v4beta" \
GO111MODULE="on" \
go test -v -run smoke ./integration/...
2 changes: 1 addition & 1 deletion test/integration/account_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestUser_GetMissing(t *testing.T) {
}
}

func TestUser_Get(t *testing.T) {
func TestUser_Get_smoke(t *testing.T) {
username := usernamePrefix + "getuser"
email := usernamePrefix + "[email protected]"
restricted := true
Expand Down
2 changes: 1 addition & 1 deletion test/integration/databases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestDatabase_Type(t *testing.T) {
}
}

func TestDatabase_List(t *testing.T) {
func TestDatabase_List_smoke(t *testing.T) {
client, database, teardown, err := setupPostgresDatabase(t, nil, "fixtures/TestDatabase_List")
if err != nil {
t.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/domain_records_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var testDomainRecordCreateOpts = linodego.DomainRecordCreateOptions{
Name: "a",
}

func TestDomainRecord_Create(t *testing.T) {
func TestDomainRecord_Create_smoke(t *testing.T) {
_, _, record, teardown, err := setupDomainRecord(t, "fixtures/TestDomainRecord_Create")
defer teardown()

Expand Down
4 changes: 2 additions & 2 deletions test/integration/domains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var testDomainCreateOpts = linodego.DomainCreateOptions{
SOAEmail: "[email protected]",
}

func TestDomain_Create(t *testing.T) {
func TestDomain_Create_smoke(t *testing.T) {
_, domain, teardown, err := setupDomain(t, "fixtures/TestDomain_Create")
defer teardown()

Expand Down Expand Up @@ -44,7 +44,7 @@ func TestDomain_Update(t *testing.T) {
}
}

func TestDomains_List(t *testing.T) {
func TestDomains_List_smoke(t *testing.T) {
client, _, teardown, err := setupDomain(t, "fixtures/TestDomains_List")
defer teardown()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/firewalls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var ignoreNetworkAddresses = cmpopts.IgnoreFields(linodego.FirewallRule{}, "Addr
// fixture sanitization, these addresses will be changed to bogus values when running tests.
var ignoreFirewallTimestamps = cmpopts.IgnoreFields(linodego.Firewall{}, "Created", "Updated")

func TestFirewalls_List(t *testing.T) {
func TestFirewalls_List_smoke(t *testing.T) {
client, _, teardown, err := setupFirewall(t, []firewallModifier{
func(createOpts *linodego.FirewallCreateOptions) {
createOpts.Label = "linodego-fw-test"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestImage_GetFound(t *testing.T) {
}
}

func TestImages_List(t *testing.T) {
func TestImages_List_smoke(t *testing.T) {
client, teardown := createTestClient(t, "fixtures/TestImages_List")
defer teardown()

Expand Down
4 changes: 2 additions & 2 deletions test/integration/instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

type instanceModifier func(*linodego.Client, *linodego.InstanceCreateOptions)

func TestInstances_List(t *testing.T) {
func TestInstances_List_smoke(t *testing.T) {
client, instance, _, teardown, err := setupInstanceWithoutDisks(t, "fixtures/TestInstances_List")
defer teardown()

Expand All @@ -37,7 +37,7 @@ func TestInstances_List(t *testing.T) {
}
}

func TestInstance_Get(t *testing.T) {
func TestInstance_Get_smoke(t *testing.T) {
client, instance, _, teardown, err := setupInstanceWithoutDisks(t, "fixtures/TestInstance_Get")
defer teardown()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/longview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestLongviewClient_Get(t *testing.T) {
}
}

func TestLongviewClient_Create(t *testing.T) {
func TestLongviewClient_Create_smoke(t *testing.T) {
client, teardown := createTestClient(t, "fixtures/TestLongviewClient_Create")
defer teardown()

Expand Down
2 changes: 1 addition & 1 deletion test/integration/network_ips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestIPAddress_GetFound(t *testing.T) {
}
}

func TestIPAddresses_List(t *testing.T) {
func TestIPAddresses_List_smoke(t *testing.T) {
client, instance, _, teardown, err := setupInstanceWithoutDisks(t, "fixtures/TestIPAddresses_List")
defer teardown()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/nodebalancer_config_nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
}
)

func TestNodeBalancerNode_Create(t *testing.T) {
func TestNodeBalancerNode_Create_smoke(t *testing.T) {
_, _, _, node, teardown, err := setupNodeBalancerNode(t, "fixtures/TestNodeBalancerNode_Create")
defer teardown()

Expand Down
2 changes: 1 addition & 1 deletion test/integration/nodebalancer_configs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var testNodeBalancerConfigCreateOpts = linodego.NodeBalancerConfigCreateOptions{
CheckInterval: 60,
}

func TestNodeBalancerConfig_Create(t *testing.T) {
func TestNodeBalancerConfig_Create_smoke(t *testing.T) {
_, _, config, teardown, err := setupNodeBalancerConfig(t, "fixtures/TestNodeBalancerConfig_Create")
defer teardown()

Expand Down
4 changes: 2 additions & 2 deletions test/integration/nodebalancers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
label = "go-test-def"
)

func TestNodeBalancer_Create(t *testing.T) {
func TestNodeBalancer_Create_create(t *testing.T) {
_, nodebalancer, teardown, err := setupNodeBalancer(t, "fixtures/TestNodeBalancer_Create")
defer teardown()

Expand Down Expand Up @@ -52,7 +52,7 @@ func TestNodeBalancer_Update(t *testing.T) {
}
}

func TestNodeBalancers_List(t *testing.T) {
func TestNodeBalancers_List_smoke(t *testing.T) {
client, _, teardown, err := setupNodeBalancer(t, "fixtures/TestNodeBalancers_List")
defer teardown()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/object_storage_buckets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var testObjectStorageBucketCreateOpts = ObjectStorageBucketCreateOptions{
Label: "go-bucket-test-def",
}

func TestObjectStorageBucket_Create(t *testing.T) {
func TestObjectStorageBucket_Create_smoke(t *testing.T) {
_, bucket, teardown, err := setupObjectStorageBucket(t,
nil,
"fixtures/TestObjectStorageBucket_Create")
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestObjectStorageBucket_GetFound(t *testing.T) {
}
}

func TestObjectStorageBuckets_List(t *testing.T) {
func TestObjectStorageBuckets_List_smoke(t *testing.T) {
client, _, teardown, err := setupObjectStorageBucket(t,
nil,
"fixtures/TestObjectStorageBuckets_List")
Expand Down
2 changes: 1 addition & 1 deletion test/integration/profile_tfa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/linode/linodego"
)

func TestTwoFactor_CreateSecret(t *testing.T) {
func TestTwoFactor_CreateSecret_smoke(t *testing.T) {
client := createMockClient(t)

expectedResponse := linodego.TwoFactorSecret{
Expand Down
2 changes: 1 addition & 1 deletion test/integration/tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
. "github.com/linode/linodego"
)

func TestTag_Create(t *testing.T) {
func TestTag_Create_create(t *testing.T) {
client, instance, teardown, err := setupTaggedInstance(t, "fixtures/TestTag_Create")
defer teardown()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/volumes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/linode/linodego"
)

func TestVolume_Create(t *testing.T) {
func TestVolume_Create_smoke(t *testing.T) {
client, teardown := createTestClient(t, "fixtures/TestVolume_Create")
defer teardown()

Expand Down Expand Up @@ -52,7 +52,7 @@ func TestVolume_Resize(t *testing.T) {
}
}

func TestVolumes_List(t *testing.T) {
func TestVolumes_List_smoke(t *testing.T) {
client, volume, teardown, err := setupVolume(t, "fixtures/TestVolume_List")
defer teardown()

Expand Down

0 comments on commit 3a8b8eb

Please sign in to comment.