diff --git a/internal/plugin/installer/oci_installer_test.go b/internal/plugin/installer/oci_installer_test.go index 885366028..c3bebdb52 100644 --- a/internal/plugin/installer/oci_installer_test.go +++ b/internal/plugin/installer/oci_installer_test.go @@ -33,6 +33,8 @@ import ( "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "helm.sh/helm/v4/internal/test/ensure" "helm.sh/helm/v4/pkg/cli" @@ -415,16 +417,11 @@ func TestOCIInstaller_Install_WithGetterOptions(t *testing.T) { // Install the plugin err = Install(installer) if tc.wantErr { - if err == nil { - t.Error("Expected installation to fail, but it succeeded") - } + require.Error(t, err, "Expected installation to fail, but it succeeded") } else { - if err != nil { - t.Errorf("Expected installation to succeed, got error: %v", err) - // Verify plugin was installed to the actual path - } else if !isPlugin(actualPath) { - t.Errorf("Expected plugin directory %s to contain plugin.yaml", actualPath) - } + require.NoError(t, err, "Expected installation to succeed, got error: %v", err) + // Verify plugin was installed to the actual path + assert.True(t, isPlugin(actualPath), "Expected plugin directory %s to contain plugin.yaml", actualPath) } }) } diff --git a/pkg/cmd/list_test.go b/pkg/cmd/list_test.go index 615b6bc88..f45616250 100644 --- a/pkg/cmd/list_test.go +++ b/pkg/cmd/list_test.go @@ -20,6 +20,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + chart "helm.sh/helm/v4/pkg/chart/v2" "helm.sh/helm/v4/pkg/release/common" release "helm.sh/helm/v4/pkg/release/v1" @@ -348,11 +351,8 @@ func TestReleaseListWriter(t *testing.T) { t.Run(tt.name, func(t *testing.T) { writer := newReleaseListWriter(tt.releases, tt.timeFormat, tt.noHeaders, tt.noColor) - if writer == nil { - t.Error("Expected writer to be non-nil") - } else if len(writer.releases) != len(tt.releases) { - t.Errorf("Expected %d releases, got %d", len(tt.releases), len(writer.releases)) - } + require.NotNil(t, writer, "Expected writer to be non-nil") + assert.Len(t, writer.releases, len(tt.releases), "Expected %d releases, got %d", len(tt.releases), len(writer.releases)) }) } }