Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Debug mode, Test failure annotations, Code Coverage #173

Merged
merged 3 commits into from
Sep 24, 2021
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
12 changes: 9 additions & 3 deletions .github/workflows/acctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
version:
- stable
terraform:
- '1.0.2'
- '1.0.7'
- '0.13.6'
steps:

Expand All @@ -58,7 +58,7 @@ jobs:
go mod download

- name: TF acceptance tests
timeout-minutes: 120
timeout-minutes: 180
env:
TF_ACC: "1"
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
Expand All @@ -68,10 +68,16 @@ jobs:

METAL_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}
run: |
go test -v -cover -parallel 4 -timeout 120m ./metal
go test -v -coverprofile coverage.txt -covermode=atomic -parallel 8 -timeout 180m ./metal
- name: Sweeper
if: ${{ always() }}
env:
METAL_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}
run: |
go test ./metal -v -sweep="tf_test"
- name: Upload coverage to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
Copy link
Member Author

Choose a reason for hiding this comment

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

This token has been added to the repo settings.

files: ./coverage.txt
21 changes: 19 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
package main

import (
"context"
"flag"
"log"

"github.com/equinix/terraform-provider-metal/metal"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: metal.Provider})
var debugMode bool

flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve")
flag.Parse()
opts := &plugin.ServeOpts{ProviderFunc: metal.Provider}

if debugMode {
err := plugin.Debug(context.Background(), "registry.terraform.io/equinix/metal", opts)
if err != nil {
log.Fatal(err.Error())
}
return
}

plugin.Serve(opts)
}