Skip to content

Commit

Permalink
remove fake linode api test and package
Browse files Browse the repository at this point in the history
  • Loading branch information
amold1 committed Sep 17, 2024
1 parent f73244c commit 95e1b28
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 225 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PLATFORM ?= linux/amd64
REGISTRY_NAME ?= index.docker.io
IMAGE_NAME ?= linode/linode-blockstorage-csi-driver
REV := $(shell git branch --show-current 2> /dev/null || echo "dev")
REV := $(shell git describe --long --tags --dirty 2> /dev/null || echo "dev")
IMAGE_VERSION ?= $(REV)
IMAGE_TAG ?= $(REGISTRY_NAME)/$(IMAGE_NAME):$(IMAGE_VERSION)
GOLANGCI_LINT_IMG := golangci/golangci-lint:v1.59-alpine
Expand Down
29 changes: 3 additions & 26 deletions internal/driver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ package driver
import (
"context"
"fmt"
"net/http/httptest"
"os"
"testing"

"github.com/linode/linode-blockstorage-csi-driver/mocks"
drivertest "github.com/linode/linode-blockstorage-csi-driver/pkg/driver-test"
linodeclient "github.com/linode/linode-blockstorage-csi-driver/pkg/linode-client"
"k8s.io/mount-utils"

"github.com/linode/linodego"

"go.uber.org/mock/gomock"
)

Expand All @@ -31,25 +27,6 @@ func TestDriverSuite(t *testing.T) {

bsPrefix := "test-"

// mock Linode Server, not working yet ...
fake := &drivertest.FakeAPI{
T: t,
Volumes: map[string]linodego.Volume{},
Instance: &linodego.Instance{
Label: "linode123",
Region: "us-east",
Image: "linode/debian9",
Type: "g6-standard-2",
Group: "Linode-Group",
ID: 123,
Status: "running",
Hypervisor: "kvm",
},
}

ts := httptest.NewServer(fake)
defer ts.Close()

mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()

Expand All @@ -61,16 +38,16 @@ func TestDriverSuite(t *testing.T) {
fileSystem := mocks.NewMockFileSystem(mockCtrl)
encrypt := NewLuksEncryption(mounter.Exec, fileSystem)

fakeCloudProvider, err := linodeclient.NewLinodeClient("dummy", fmt.Sprintf("LinodeCSI/%s", vendorVersion), ts.URL)
fakeCloudProvider, err := linodeclient.NewLinodeClient("dummy", fmt.Sprintf("LinodeCSI/%s", vendorVersion), "")
if err != nil {
t.Fatalf("Failed to setup Linode client: %s", err)
}

// TODO fake metadata
md := Metadata{
ID: 123,
Label: fake.Instance.Label,
Region: fake.Instance.Region,
Label: "linode123",
Region: "us-east",
Memory: 4 << 30, // 4GiB
}
linodeDriver := GetLinodeDriver(context.Background())
Expand Down
198 changes: 0 additions & 198 deletions pkg/driver-test/fake-api.go

This file was deleted.

0 comments on commit 95e1b28

Please sign in to comment.