test: finish AX v0.8.0 naming compliance
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
6ee40b66b6
commit
0989254250
6 changed files with 78 additions and 78 deletions
|
|
@ -145,7 +145,7 @@ func TestDevOps_Status_Good(t *testing.T) {
|
|||
assert.Equal(t, 4, status.CPUs)
|
||||
}
|
||||
|
||||
func TestDevOps_Status_NotInstalled_Good(t *testing.T) {
|
||||
func TestDevOps_StatusNotInstalled_Good(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ func TestDevOps_Status_NotInstalled_Good(t *testing.T) {
|
|||
assert.Equal(t, 2222, status.SSHPort)
|
||||
}
|
||||
|
||||
func TestDevOps_Status_NoContainer_Good(t *testing.T) {
|
||||
func TestDevOps_StatusNoContainer_Good(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ func TestDevOps_IsRunning_Good(t *testing.T) {
|
|||
assert.True(t, running)
|
||||
}
|
||||
|
||||
func TestDevOps_IsRunning_NotRunning_Bad(t *testing.T) {
|
||||
func TestDevOps_IsRunningNotRunning_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ func TestDevOps_IsRunning_NotRunning_Bad(t *testing.T) {
|
|||
assert.False(t, running)
|
||||
}
|
||||
|
||||
func TestDevOps_IsRunning_ContainerStopped_Bad(t *testing.T) {
|
||||
func TestDevOps_IsRunningContainerStopped_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ func TestDevOps_findContainer_Good(t *testing.T) {
|
|||
assert.Equal(t, "my-container", found.Name)
|
||||
}
|
||||
|
||||
func TestDevOps_findContainer_NotFound_Bad(t *testing.T) {
|
||||
func TestDevOps_findContainerNotFound_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ func TestDevOps_findContainer_NotFound_Bad(t *testing.T) {
|
|||
assert.Nil(t, found)
|
||||
}
|
||||
|
||||
func TestDevOps_Stop_NotFound_Bad(t *testing.T) {
|
||||
func TestDevOps_StopNotFound_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -406,7 +406,7 @@ func TestDevStatus_Struct_Good(t *testing.T) {
|
|||
assert.Equal(t, time.Hour, status.Uptime)
|
||||
}
|
||||
|
||||
func TestDevOps_Boot_NotInstalled_Bad(t *testing.T) {
|
||||
func TestDevOps_BootNotInstalled_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ func TestDevOps_Boot_NotInstalled_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "not installed")
|
||||
}
|
||||
|
||||
func TestDevOps_Boot_AlreadyRunning_Bad(t *testing.T) {
|
||||
func TestDevOps_BootAlreadyRunning_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -468,7 +468,7 @@ func TestDevOps_Boot_AlreadyRunning_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "already running")
|
||||
}
|
||||
|
||||
func TestDevOps_Status_WithImageVersion_Good(t *testing.T) {
|
||||
func TestDevOps_StatusWithImageVersion_Good(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -504,7 +504,7 @@ func TestDevOps_Status_WithImageVersion_Good(t *testing.T) {
|
|||
assert.Equal(t, "v1.2.3", status.ImageVersion)
|
||||
}
|
||||
|
||||
func TestDevOps_findContainer_MultipleContainers_Good(t *testing.T) {
|
||||
func TestDevOps_findContainerMultipleContainers_Good(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -549,7 +549,7 @@ func TestDevOps_findContainer_MultipleContainers_Good(t *testing.T) {
|
|||
assert.Equal(t, "id-2", found.ID)
|
||||
}
|
||||
|
||||
func TestDevOps_Status_ContainerWithUptime_Good(t *testing.T) {
|
||||
func TestDevOps_StatusContainerWithUptime_Good(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -586,7 +586,7 @@ func TestDevOps_Status_ContainerWithUptime_Good(t *testing.T) {
|
|||
assert.GreaterOrEqual(t, status.Uptime.Hours(), float64(1))
|
||||
}
|
||||
|
||||
func TestDevOps_IsRunning_DifferentContainerName_Bad(t *testing.T) {
|
||||
func TestDevOps_IsRunningDifferentContainerName_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -621,7 +621,7 @@ func TestDevOps_IsRunning_DifferentContainerName_Bad(t *testing.T) {
|
|||
assert.False(t, running)
|
||||
}
|
||||
|
||||
func TestDevOps_Boot_FreshFlag_Good(t *testing.T) {
|
||||
func TestDevOps_BootFreshFlag_Good(t *testing.T) {
|
||||
t.Setenv("CORE_SKIP_SSH_SCAN", "true")
|
||||
tempDir := newManagedTempDir(t, "devops-test-")
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
|
@ -669,7 +669,7 @@ func TestDevOps_Boot_FreshFlag_Good(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestDevOps_Stop_ContainerNotRunning_Bad(t *testing.T) {
|
||||
func TestDevOps_StopContainerNotRunning_Bad(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
||||
|
|
@ -704,7 +704,7 @@ func TestDevOps_Stop_ContainerNotRunning_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "not running")
|
||||
}
|
||||
|
||||
func TestDevOps_Boot_FreshWithNoExisting_Good(t *testing.T) {
|
||||
func TestDevOps_BootFreshWithNoExisting_Good(t *testing.T) {
|
||||
t.Setenv("CORE_SKIP_SSH_SCAN", "true")
|
||||
tempDir := newManagedTempDir(t, "devops-boot-fresh-")
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
|
@ -749,7 +749,7 @@ func TestImageName_Format_Good(t *testing.T) {
|
|||
assert.True(t, core.PathExt(name) == ".qcow2")
|
||||
}
|
||||
|
||||
func TestDevOps_Install_Delegates_Good(t *testing.T) {
|
||||
func TestDevOps_InstallDelegates_Good(t *testing.T) {
|
||||
// This test verifies the Install method delegates to ImageManager
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
|
@ -767,7 +767,7 @@ func TestDevOps_Install_Delegates_Good(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestDevOps_CheckUpdate_Delegates_Good(t *testing.T) {
|
||||
func TestDevOps_CheckUpdateDelegates_Good(t *testing.T) {
|
||||
// This test verifies the CheckUpdate method delegates to ImageManager
|
||||
tempDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
|
@ -785,7 +785,7 @@ func TestDevOps_CheckUpdate_Delegates_Good(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestDevOps_Boot_Success_Good(t *testing.T) {
|
||||
func TestDevOps_BootSuccess_Good(t *testing.T) {
|
||||
t.Setenv("CORE_SKIP_SSH_SCAN", "true")
|
||||
tempDir := newManagedTempDir(t, "devops-boot-success-")
|
||||
t.Setenv("CORE_IMAGES_DIR", tempDir)
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ func TestImageInfo_Struct_Good(t *testing.T) {
|
|||
assert.Equal(t, "github", info.Source)
|
||||
}
|
||||
|
||||
func TestManifest_Save_CreatesDirs_Good(t *testing.T) {
|
||||
func TestManifest_SaveCreatesDirs_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
nestedPath := coreutil.JoinPath(tmpDir, "nested", "dir", "manifest.json")
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ func TestManifest_Save_CreatesDirs_Good(t *testing.T) {
|
|||
assert.True(t, io.Local.IsFile(nestedPath))
|
||||
}
|
||||
|
||||
func TestManifest_Save_Overwrite_Good(t *testing.T) {
|
||||
func TestManifest_SaveOverwrite_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
path := coreutil.JoinPath(tmpDir, "manifest.json")
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ func TestManifest_Save_Overwrite_Good(t *testing.T) {
|
|||
assert.False(t, exists)
|
||||
}
|
||||
|
||||
func TestImageManager_Install_NoSourceAvailable_Bad(t *testing.T) {
|
||||
func TestImageManager_InstallNoSourceAvailable_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ func (m *mockImageSource) Download(ctx context.Context, medium io.Medium, dest s
|
|||
return medium.Write(imagePath, "mock image content")
|
||||
}
|
||||
|
||||
func TestImageManager_Install_WithMockSource_Good(t *testing.T) {
|
||||
func TestImageManager_InstallWithMockSource_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ func TestImageManager_Install_WithMockSource_Good(t *testing.T) {
|
|||
assert.Equal(t, "mock", info.Source)
|
||||
}
|
||||
|
||||
func TestImageManager_Install_DownloadError_Bad(t *testing.T) {
|
||||
func TestImageManager_InstallDownloadError_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -339,7 +339,7 @@ func TestImageManager_Install_DownloadError_Bad(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestImageManager_Install_VersionError_Bad(t *testing.T) {
|
||||
func TestImageManager_InstallVersionError_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ func TestImageManager_Install_VersionError_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "failed to get latest version")
|
||||
}
|
||||
|
||||
func TestImageManager_Install_SkipsUnavailableSource_Good(t *testing.T) {
|
||||
func TestImageManager_InstallSkipsUnavailableSource_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -390,7 +390,7 @@ func TestImageManager_Install_SkipsUnavailableSource_Good(t *testing.T) {
|
|||
assert.Equal(t, "available", info.Source)
|
||||
}
|
||||
|
||||
func TestImageManager_CheckUpdate_WithMockSource_Good(t *testing.T) {
|
||||
func TestImageManager_CheckUpdateWithMockSource_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ func TestImageManager_CheckUpdate_WithMockSource_Good(t *testing.T) {
|
|||
assert.True(t, hasUpdate)
|
||||
}
|
||||
|
||||
func TestImageManager_CheckUpdate_NoUpdate_Good(t *testing.T) {
|
||||
func TestImageManager_CheckUpdateNoUpdate_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ func TestImageManager_CheckUpdate_NoUpdate_Good(t *testing.T) {
|
|||
assert.False(t, hasUpdate)
|
||||
}
|
||||
|
||||
func TestImageManager_CheckUpdate_NoSource_Bad(t *testing.T) {
|
||||
func TestImageManager_CheckUpdateNoSource_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -477,7 +477,7 @@ func TestImageManager_CheckUpdate_NoSource_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "no image source available")
|
||||
}
|
||||
|
||||
func TestImageManager_CheckUpdate_VersionError_Bad(t *testing.T) {
|
||||
func TestImageManager_CheckUpdateVersionError_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -505,7 +505,7 @@ func TestImageManager_CheckUpdate_VersionError_Bad(t *testing.T) {
|
|||
assert.Equal(t, "v1.0.0", current) // Current should still be returned
|
||||
}
|
||||
|
||||
func TestImageManager_Install_EmptySources_Bad(t *testing.T) {
|
||||
func TestImageManager_InstallEmptySources_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -521,7 +521,7 @@ func TestImageManager_Install_EmptySources_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "no image source available")
|
||||
}
|
||||
|
||||
func TestImageManager_Install_AllUnavailable_Bad(t *testing.T) {
|
||||
func TestImageManager_InstallAllUnavailable_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
@ -540,7 +540,7 @@ func TestImageManager_Install_AllUnavailable_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "no image source available")
|
||||
}
|
||||
|
||||
func TestImageManager_CheckUpdate_FirstSourceUnavailable_Good(t *testing.T) {
|
||||
func TestImageManager_CheckUpdateFirstSourceUnavailable_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
t.Setenv("CORE_IMAGES_DIR", tmpDir)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func TestQemuHypervisor_Available_Good(t *testing.T) {
|
|||
assert.IsType(t, true, available)
|
||||
}
|
||||
|
||||
func TestQemuHypervisor_Available_InvalidBinary_Bad(t *testing.T) {
|
||||
func TestQemuHypervisor_AvailableInvalidBinary_Bad(t *testing.T) {
|
||||
q := &QemuHypervisor{
|
||||
Binary: "nonexistent-qemu-binary-that-does-not-exist",
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ func TestHyperkitHypervisor_Available_Good(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_Available_NotDarwin_Bad(t *testing.T) {
|
||||
func TestHyperkitHypervisor_AvailableNotDarwin_Bad(t *testing.T) {
|
||||
if runtime.GOOS == "darwin" {
|
||||
t.Skip("This test only runs on non-darwin systems")
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ func TestHyperkitHypervisor_Available_NotDarwin_Bad(t *testing.T) {
|
|||
assert.False(t, available, "Hyperkit should not be available on non-darwin systems")
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_Available_InvalidBinary_Bad(t *testing.T) {
|
||||
func TestHyperkitHypervisor_AvailableInvalidBinary_Bad(t *testing.T) {
|
||||
h := &HyperkitHypervisor{
|
||||
Binary: "nonexistent-hyperkit-binary-that-does-not-exist",
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ func TestGetHypervisor_Unknown_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "unknown hypervisor")
|
||||
}
|
||||
|
||||
func TestQemuHypervisor_BuildCommand_WithPortsAndVolumes_Good(t *testing.T) {
|
||||
func TestQemuHypervisor_BuildCommandWithPortsAndVolumes_Good(t *testing.T) {
|
||||
q := NewQemuHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -172,7 +172,7 @@ func TestQemuHypervisor_BuildCommand_WithPortsAndVolumes_Good(t *testing.T) {
|
|||
assert.Contains(t, args, "4")
|
||||
}
|
||||
|
||||
func TestQemuHypervisor_BuildCommand_QCow2Format_Good(t *testing.T) {
|
||||
func TestQemuHypervisor_BuildCommandQCow2Format_Good(t *testing.T) {
|
||||
q := NewQemuHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -192,7 +192,7 @@ func TestQemuHypervisor_BuildCommand_QCow2Format_Good(t *testing.T) {
|
|||
assert.True(t, found, "Should have qcow2 drive argument")
|
||||
}
|
||||
|
||||
func TestQemuHypervisor_BuildCommand_VMDKFormat_Good(t *testing.T) {
|
||||
func TestQemuHypervisor_BuildCommandVMDKFormat_Good(t *testing.T) {
|
||||
q := NewQemuHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -212,7 +212,7 @@ func TestQemuHypervisor_BuildCommand_VMDKFormat_Good(t *testing.T) {
|
|||
assert.True(t, found, "Should have vmdk drive argument")
|
||||
}
|
||||
|
||||
func TestQemuHypervisor_BuildCommand_RawFormat_Good(t *testing.T) {
|
||||
func TestQemuHypervisor_BuildCommandRawFormat_Good(t *testing.T) {
|
||||
q := NewQemuHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -232,7 +232,7 @@ func TestQemuHypervisor_BuildCommand_RawFormat_Good(t *testing.T) {
|
|||
assert.True(t, found, "Should have raw drive argument")
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_BuildCommand_WithPorts_Good(t *testing.T) {
|
||||
func TestHyperkitHypervisor_BuildCommandWithPorts_Good(t *testing.T) {
|
||||
h := NewHyperkitHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -255,7 +255,7 @@ func TestHyperkitHypervisor_BuildCommand_WithPorts_Good(t *testing.T) {
|
|||
assert.Contains(t, args, "2")
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_BuildCommand_QCow2Format_Good(t *testing.T) {
|
||||
func TestHyperkitHypervisor_BuildCommandQCow2Format_Good(t *testing.T) {
|
||||
h := NewHyperkitHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -266,7 +266,7 @@ func TestHyperkitHypervisor_BuildCommand_QCow2Format_Good(t *testing.T) {
|
|||
assert.NotNil(t, cmd)
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_BuildCommand_RawFormat_Good(t *testing.T) {
|
||||
func TestHyperkitHypervisor_BuildCommandRawFormat_Good(t *testing.T) {
|
||||
h := NewHyperkitHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -277,7 +277,7 @@ func TestHyperkitHypervisor_BuildCommand_RawFormat_Good(t *testing.T) {
|
|||
assert.NotNil(t, cmd)
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_BuildCommand_NoPorts_Good(t *testing.T) {
|
||||
func TestHyperkitHypervisor_BuildCommandNoPorts_Good(t *testing.T) {
|
||||
h := NewHyperkitHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -293,7 +293,7 @@ func TestHyperkitHypervisor_BuildCommand_NoPorts_Good(t *testing.T) {
|
|||
assert.NotNil(t, cmd)
|
||||
}
|
||||
|
||||
func TestQemuHypervisor_BuildCommand_NoSSHPort_Good(t *testing.T) {
|
||||
func TestQemuHypervisor_BuildCommandNoSSHPort_Good(t *testing.T) {
|
||||
q := NewQemuHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -309,7 +309,7 @@ func TestQemuHypervisor_BuildCommand_NoSSHPort_Good(t *testing.T) {
|
|||
assert.NotNil(t, cmd)
|
||||
}
|
||||
|
||||
func TestQemuHypervisor_BuildCommand_UnknownFormat_Bad(t *testing.T) {
|
||||
func TestQemuHypervisor_BuildCommandUnknownFormat_Bad(t *testing.T) {
|
||||
q := NewQemuHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -320,7 +320,7 @@ func TestQemuHypervisor_BuildCommand_UnknownFormat_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "unknown image format")
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_BuildCommand_UnknownFormat_Bad(t *testing.T) {
|
||||
func TestHyperkitHypervisor_BuildCommandUnknownFormat_Bad(t *testing.T) {
|
||||
h := NewHyperkitHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -336,7 +336,7 @@ func TestHyperkitHypervisor_Name_Good(t *testing.T) {
|
|||
assert.Equal(t, "hyperkit", h.Name())
|
||||
}
|
||||
|
||||
func TestHyperkitHypervisor_BuildCommand_ISOFormat_Good(t *testing.T) {
|
||||
func TestHyperkitHypervisor_BuildCommandISOFormat_Good(t *testing.T) {
|
||||
h := NewHyperkitHypervisor()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ func TestLinuxKit_NewLinuxKitManagerWithHypervisor_Good(t *testing.T) {
|
|||
assert.Equal(t, mock, manager.Hypervisor())
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_Detached_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_RunDetached_Good(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
// Create a test image file
|
||||
|
|
@ -126,7 +126,7 @@ func TestLinuxKitManager_Run_Detached_Good(t *testing.T) {
|
|||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_DefaultValues_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_RunDefaultValues_Good(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
imagePath := coreutil.JoinPath(tmpDir, "test.qcow2")
|
||||
|
|
@ -151,7 +151,7 @@ func TestLinuxKitManager_Run_DefaultValues_Good(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_ImageNotFound_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_RunImageNotFound_Bad(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -162,7 +162,7 @@ func TestLinuxKitManager_Run_ImageNotFound_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "image not found")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_UnsupportedFormat_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_RunUnsupportedFormat_Bad(t *testing.T) {
|
||||
manager, _, tmpDir := newTestManager(t)
|
||||
|
||||
imagePath := coreutil.JoinPath(tmpDir, "test.txt")
|
||||
|
|
@ -202,7 +202,7 @@ func TestLinuxKitManager_Stop_Good(t *testing.T) {
|
|||
assert.Equal(t, StatusStopped, c.Status)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Stop_NotFound_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_StopNotFound_Bad(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -212,7 +212,7 @@ func TestLinuxKitManager_Stop_NotFound_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "container not found")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Stop_NotRunning_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_StopNotRunning_Bad(t *testing.T) {
|
||||
_, _, tmpDir := newTestManager(t)
|
||||
statePath := coreutil.JoinPath(tmpDir, "containers.json")
|
||||
state, err := LoadState(statePath)
|
||||
|
|
@ -249,7 +249,7 @@ func TestLinuxKitManager_List_Good(t *testing.T) {
|
|||
assert.Len(t, containers, 2)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_List_VerifiesRunningStatus_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_ListVerifiesRunningStatus_Good(t *testing.T) {
|
||||
_, _, tmpDir := newTestManager(t)
|
||||
statePath := coreutil.JoinPath(tmpDir, "containers.json")
|
||||
state, err := LoadState(statePath)
|
||||
|
|
@ -301,7 +301,7 @@ func TestLinuxKitManager_Logs_Good(t *testing.T) {
|
|||
assert.Equal(t, logContent, string(buf[:n]))
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Logs_NotFound_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_LogsNotFound_Bad(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -311,7 +311,7 @@ func TestLinuxKitManager_Logs_NotFound_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "container not found")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Logs_NoLogFile_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_LogsNoLogFile_Bad(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
// Use a unique ID that won't have a log file
|
||||
|
|
@ -334,7 +334,7 @@ func TestLinuxKitManager_Logs_NoLogFile_Bad(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Exec_NotFound_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_ExecNotFound_Bad(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -344,7 +344,7 @@ func TestLinuxKitManager_Exec_NotFound_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "container not found")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Exec_NotRunning_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_ExecNotRunning_Bad(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
container := &Container{ID: "abc12345", Status: StatusStopped}
|
||||
|
|
@ -427,7 +427,7 @@ func TestQemuHypervisor_BuildCommand_Good(t *testing.T) {
|
|||
assert.Contains(t, args, "-nographic")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Logs_Follow_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_LogsFollow_Good(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
// Create a unique container ID
|
||||
|
|
@ -465,7 +465,7 @@ func TestLinuxKitManager_Logs_Follow_Good(t *testing.T) {
|
|||
assert.NoError(t, reader.Close())
|
||||
}
|
||||
|
||||
func TestFollowReader_Read_WithData_Good(t *testing.T) {
|
||||
func TestFollowReader_ReadWithData_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
logPath := coreutil.JoinPath(tmpDir, "test.log")
|
||||
|
||||
|
|
@ -498,7 +498,7 @@ func TestFollowReader_Read_WithData_Good(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestFollowReader_Read_ContextCancel_Good(t *testing.T) {
|
||||
func TestFollowReader_ReadContextCancel_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
logPath := coreutil.JoinPath(tmpDir, "test.log")
|
||||
|
||||
|
|
@ -549,7 +549,7 @@ func TestNewFollowReader_FileNotFound_Bad(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_BuildCommandError_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_RunBuildCommandError_Bad(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
// Create a test image file
|
||||
|
|
@ -568,7 +568,7 @@ func TestLinuxKitManager_Run_BuildCommandError_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "failed to build hypervisor command")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_Foreground_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_RunForeground_Good(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
// Create a test image file
|
||||
|
|
@ -596,7 +596,7 @@ func TestLinuxKitManager_Run_Foreground_Good(t *testing.T) {
|
|||
assert.Equal(t, StatusStopped, container.Status)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Stop_ContextCancelled_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_StopContextCancelled_Good(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
// Create a test image file
|
||||
|
|
@ -645,7 +645,7 @@ func TestIsProcessRunning_NonexistentProcess_Bad(t *testing.T) {
|
|||
assert.False(t, running)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_WithPortsAndVolumes_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_RunWithPortsAndVolumes_Good(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
imagePath := coreutil.JoinPath(tmpDir, "test.iso")
|
||||
|
|
@ -674,7 +674,7 @@ func TestLinuxKitManager_Run_WithPortsAndVolumes_Good(t *testing.T) {
|
|||
time.Sleep(50 * time.Millisecond)
|
||||
}
|
||||
|
||||
func TestFollowReader_Read_ReaderError_Bad(t *testing.T) {
|
||||
func TestFollowReader_ReadReaderError_Bad(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
logPath := coreutil.JoinPath(tmpDir, "test.log")
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ func TestFollowReader_Read_ReaderError_Bad(t *testing.T) {
|
|||
assert.Error(t, readErr)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_StartError_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_RunStartError_Bad(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
imagePath := coreutil.JoinPath(tmpDir, "test.iso")
|
||||
|
|
@ -716,7 +716,7 @@ func TestLinuxKitManager_Run_StartError_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "failed to start VM")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_ForegroundStartError_Bad(t *testing.T) {
|
||||
func TestLinuxKitManager_RunForegroundStartError_Bad(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
imagePath := coreutil.JoinPath(tmpDir, "test.iso")
|
||||
|
|
@ -737,7 +737,7 @@ func TestLinuxKitManager_Run_ForegroundStartError_Bad(t *testing.T) {
|
|||
assert.Contains(t, err.Error(), "failed to start VM")
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Run_ForegroundWithError_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_RunForegroundWithError_Good(t *testing.T) {
|
||||
manager, mock, tmpDir := newTestManager(t)
|
||||
|
||||
imagePath := coreutil.JoinPath(tmpDir, "test.iso")
|
||||
|
|
@ -760,7 +760,7 @@ func TestLinuxKitManager_Run_ForegroundWithError_Good(t *testing.T) {
|
|||
assert.Equal(t, StatusError, container.Status)
|
||||
}
|
||||
|
||||
func TestLinuxKitManager_Stop_ProcessExitedWhileRunning_Good(t *testing.T) {
|
||||
func TestLinuxKitManager_StopProcessExitedWhileRunning_Good(t *testing.T) {
|
||||
manager, _, _ := newTestManager(t)
|
||||
|
||||
// Add a "running" container with a process that has already exited
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ func TestCDNSource_Download_Bad(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestCDNSource_LatestVersion_NoManifest_Bad(t *testing.T) {
|
||||
func TestCDNSource_LatestVersionNoManifest_Bad(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}))
|
||||
|
|
@ -131,7 +131,7 @@ func TestCDNSource_LatestVersion_NoManifest_Bad(t *testing.T) {
|
|||
assert.Equal(t, "latest", version)
|
||||
}
|
||||
|
||||
func TestCDNSource_LatestVersion_ServerError_Bad(t *testing.T) {
|
||||
func TestCDNSource_LatestVersionServerError_Bad(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
}))
|
||||
|
|
@ -147,7 +147,7 @@ func TestCDNSource_LatestVersion_ServerError_Bad(t *testing.T) {
|
|||
assert.Equal(t, "latest", version)
|
||||
}
|
||||
|
||||
func TestCDNSource_Download_NoProgress_Good(t *testing.T) {
|
||||
func TestCDNSource_DownloadNoProgress_Good(t *testing.T) {
|
||||
content := "test content"
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Length", core.Sprintf("%d", len(content)))
|
||||
|
|
@ -171,7 +171,7 @@ func TestCDNSource_Download_NoProgress_Good(t *testing.T) {
|
|||
assert.Equal(t, content, data)
|
||||
}
|
||||
|
||||
func TestCDNSource_Download_LargeFile_Good(t *testing.T) {
|
||||
func TestCDNSource_DownloadLargeFile_Good(t *testing.T) {
|
||||
// Create content larger than buffer size (32KB)
|
||||
content := make([]byte, 64*1024) // 64KB
|
||||
for i := range content {
|
||||
|
|
@ -203,7 +203,7 @@ func TestCDNSource_Download_LargeFile_Good(t *testing.T) {
|
|||
assert.Equal(t, int64(len(content)), lastDownloaded)
|
||||
}
|
||||
|
||||
func TestCDNSource_Download_HTTPErrorCodes_Bad(t *testing.T) {
|
||||
func TestCDNSource_DownloadHTTPErrorCodes_Bad(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
statusCode int
|
||||
|
|
@ -265,7 +265,7 @@ func TestCDN_NewCDNSource_Good(t *testing.T) {
|
|||
assert.Equal(t, cfg.CDNURL, src.config.CDNURL)
|
||||
}
|
||||
|
||||
func TestCDNSource_Download_CreatesDestDir_Good(t *testing.T) {
|
||||
func TestCDNSource_DownloadCreatesDestDir_Good(t *testing.T) {
|
||||
content := "test content"
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ func TestState_Remove_Good(t *testing.T) {
|
|||
assert.False(t, ok)
|
||||
}
|
||||
|
||||
func TestState_Get_NotFound_Bad(t *testing.T) {
|
||||
func TestState_GetNotFound_Bad(t *testing.T) {
|
||||
state := NewState("/tmp/test-state.json")
|
||||
|
||||
_, ok := state.Get("nonexistent")
|
||||
|
|
@ -160,7 +160,7 @@ func TestState_All_Good(t *testing.T) {
|
|||
assert.Len(t, all, 3)
|
||||
}
|
||||
|
||||
func TestState_SaveState_CreatesDirectory_Good(t *testing.T) {
|
||||
func TestState_SaveStateCreatesDirectory_Good(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
nestedPath := coreutil.JoinPath(tmpDir, "nested", "dir", "containers.json")
|
||||
state := NewState(nestedPath)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue