You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ossie.apache.org by jb...@apache.org on 2026/07/13 16:16:09 UTC

(ossie) 05/10: test(cli): add test coverage for plugin setup field

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch pr-6
in repository https://gitbox.apache.org/repos/asf/ossie.git

commit 8fdac36ae6a94beef3b9a02783003a9daeed56c3
Author: Quigley Malcolm <qu...@dbtlabs.com>
AuthorDate: Mon Jun 15 10:30:10 2026 -0500

    test(cli): add test coverage for plugin setup field
    
    Adds two cases: setup path is correctly parsed when present, and
    setup is empty string when the field is absent from plugin.yaml.
    The setup path is consumed by the install segment (P2) when running
    the plugin's setup script.
---
 cli/internal/plugin/discover_test.go | 48 ++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/cli/internal/plugin/discover_test.go b/cli/internal/plugin/discover_test.go
index 557cb4d..2c82475 100644
--- a/cli/internal/plugin/discover_test.go
+++ b/cli/internal/plugin/discover_test.go
@@ -286,3 +286,51 @@ func TestDiscover_strayFileIgnored(t *testing.T) {
 	}
 }
 
+func TestDiscover_setupFieldPopulated(t *testing.T) {
+	root := t.TempDir()
+	writePlugin(t, root, "with-setup", `
+ossie_plugin_spec: "0.1.0"
+ossie_spec_version: ">=0.2.0"
+platform:
+  name: dbt
+setup: bin/setup
+convert:
+  to_osi:
+    invoke: ["bin/convert", "to-osi"]
+    accepts: [".yaml"]
+  from_osi:
+    invoke: ["bin/convert", "from-osi"]
+`)
+	var stderr strings.Builder
+
+	plugins, err := plugin.Discover(root, &stderr)
+	if err != nil {
+		t.Fatalf("unexpected error: %v", err)
+	}
+	if len(plugins) != 1 {
+		t.Fatalf("expected 1 plugin, got %d", len(plugins))
+	}
+	if plugins[0].Setup != "bin/setup" {
+		t.Errorf("Setup: got %q, want %q", plugins[0].Setup, "bin/setup")
+	}
+	if stderr.Len() != 0 {
+		t.Errorf("unexpected warning: %q", stderr.String())
+	}
+}
+
+func TestDiscover_setupFieldAbsent(t *testing.T) {
+	root := t.TempDir()
+	writePlugin(t, root, "no-setup", validPluginYAML)
+	var stderr strings.Builder
+
+	plugins, err := plugin.Discover(root, &stderr)
+	if err != nil {
+		t.Fatalf("unexpected error: %v", err)
+	}
+	if len(plugins) != 1 {
+		t.Fatalf("expected 1 plugin, got %d", len(plugins))
+	}
+	if plugins[0].Setup != "" {
+		t.Errorf("Setup: got %q, want empty string", plugins[0].Setup)
+	}
+}