Initial pipelines server, CLI, TUI, and Go installation
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package examples_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"pipelines/examples"
|
||||
"pipelines/internal/pipeline"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReadmeThreeStageExampleIsValid(t *testing.T) {
|
||||
source, err := os.ReadFile("three-stage.md")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
graph, err := pipeline.Parse(string(source))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(graph.Stages) != 3 || graph.Settings != nil {
|
||||
t.Fatal("example must be manual-only and three stages")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCatalogContainsValidUnpublishedTemplates(t *testing.T) {
|
||||
items := examples.Catalog()
|
||||
if len(items) != 11 {
|
||||
t.Fatal("unexpected catalog size", len(items))
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
for _, item := range items {
|
||||
if seen[item.Key] || item.Description == "" || item.Name == "" {
|
||||
t.Fatal("invalid template metadata", item.Key)
|
||||
}
|
||||
seen[item.Key] = true
|
||||
graph, err := pipeline.Parse(item.Source)
|
||||
if err != nil {
|
||||
t.Fatal(item.Key, err)
|
||||
}
|
||||
if (graph.Settings != nil) != item.Scheduled {
|
||||
t.Fatal("missing schedule warning", item.Key)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user