mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-08 09:15:29 -04:00
Check for 404 errors in GCP termination
This commit is contained in:
parent
9f599c3993
commit
c954ec089f
6 changed files with 179 additions and 43 deletions
|
@ -3,10 +3,12 @@ package client
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/edgelesssys/constellation/internal/cloud/cloudtypes"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/api/googleapi"
|
||||
computepb "google.golang.org/genproto/googleapis/cloud/compute/v1"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
@ -180,6 +182,8 @@ func TestCreateInstances(t *testing.T) {
|
|||
|
||||
func TestTerminateInstances(t *testing.T) {
|
||||
someErr := errors.New("failed")
|
||||
notFoundErr := &googleapi.Error{Code: http.StatusNotFound}
|
||||
|
||||
testCases := map[string]struct {
|
||||
operationZoneAPI operationZoneAPI
|
||||
operationGlobalAPI operationGlobalAPI
|
||||
|
@ -202,6 +206,18 @@ func TestTerminateInstances(t *testing.T) {
|
|||
instanceGroupManagersAPI: stubInstanceGroupManagersAPI{},
|
||||
missingWorkerInstanceGroup: true,
|
||||
},
|
||||
"instances not found": {
|
||||
operationZoneAPI: stubOperationZoneAPI{},
|
||||
operationGlobalAPI: stubOperationGlobalAPI{},
|
||||
instanceTemplateAPI: stubInstanceTemplateAPI{},
|
||||
instanceGroupManagersAPI: stubInstanceGroupManagersAPI{deleteErr: notFoundErr},
|
||||
},
|
||||
"templates not found": {
|
||||
operationZoneAPI: stubOperationZoneAPI{},
|
||||
operationGlobalAPI: stubOperationGlobalAPI{},
|
||||
instanceTemplateAPI: stubInstanceTemplateAPI{deleteErr: notFoundErr},
|
||||
instanceGroupManagersAPI: stubInstanceGroupManagersAPI{},
|
||||
},
|
||||
"fail delete instanceGroupManager": {
|
||||
operationZoneAPI: stubOperationZoneAPI{},
|
||||
operationGlobalAPI: stubOperationGlobalAPI{},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue