From ecf92b18cc2e4742f801cf72bb39755288b494a0 Mon Sep 17 00:00:00 2001 From: Drew Sirenko <68304519+AndrewSirenko@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:50:22 -0400 Subject: [PATCH] Stub nodeService so MacOS can run e2e tests --- pkg/mounter/mount_unsupported.go | 98 ++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 pkg/mounter/mount_unsupported.go diff --git a/pkg/mounter/mount_unsupported.go b/pkg/mounter/mount_unsupported.go new file mode 100644 index 0000000000..394f72df2d --- /dev/null +++ b/pkg/mounter/mount_unsupported.go @@ -0,0 +1,98 @@ +//go:build darwin +// +build darwin + +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package mounter + +import ( + "fmt" + mountutils "k8s.io/mount-utils" +) + +const ( + stubMessage = "nodeService is unsupported for this platform" +) + +/* +NOTE: This is stub implementation of nodeService so that maintainers without access to a Linux/Windows workstation can +run driver e2e tests. +*/ + +func NewSafeMounter() (*mountutils.SafeFormatAndMount, error) { + return nil, fmt.Errorf("NewSafeMounter is not supported on this platform") +} + +func NewSafeMounterV2() (*mountutils.SafeFormatAndMount, error) { + return nil, fmt.Errorf("NewSafeMounterV2 is not supported on this platform") +} + +func (m *NodeMounter) FindDevicePath(devicePath, volumeID, partition, region string) (string, error) { + return stubMessage, fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) PreparePublishTarget(target string) error { + return fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) IsBlockDevice(fullPath string) (bool, error) { + return false, fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) GetBlockSizeBytes(devicePath string) (int64, error) { + return 1, fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) appendPartition(devicePath, partition string) string { + return stubMessage +} + +func (m NodeMounter) GetDeviceNameFromMount(mountPath string) (string, int, error) { + return stubMessage, 0, fmt.Errorf(stubMessage) +} + +func (m NodeMounter) IsCorruptedMnt(err error) bool { + return false +} + +func (m *NodeMounter) MakeFile(path string) error { + return fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) MakeDir(path string) error { + return fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) PathExists(path string) (bool, error) { + return false, fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) Resize(devicePath, deviceMountPath string) (bool, error) { + return false, fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) NeedResize(devicePath string, deviceMountPath string) (bool, error) { + return false, fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) Unpublish(path string) error { + return fmt.Errorf(stubMessage) +} + +func (m *NodeMounter) Unstage(path string) error { + return fmt.Errorf(stubMessage) +}