From e95e320109d892c8ab5fe41a1263fb6afdc70bf3 Mon Sep 17 00:00:00 2001 From: Shane Unruh Date: Thu, 18 Sep 2025 16:14:10 -0600 Subject: [PATCH] Changed test to remove pkg/schemas/jsonschemas when done Signed-off-by: Shane Unruh --- pkg/schemas/inventory_test.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pkg/schemas/inventory_test.go b/pkg/schemas/inventory_test.go index bf4dae2..3834b65 100644 --- a/pkg/schemas/inventory_test.go +++ b/pkg/schemas/inventory_test.go @@ -54,8 +54,15 @@ func TestGenerateAndWriteSchemas(t *testing.T) { } ) + dir, err := os.Getwd() + if err != nil { + log.Printf("Failed to find workding dir. err: %s\n", err) + } + if err := os.MkdirAll(path, 0755); err != nil { - t.Fatal("Failed to create schema directory") + t.Fatalf("Failed to create schema directory: %s/%s", dir, path) + } else { + log.Printf("created: %s/%s\n", dir, path) } for filename, model := range schemas { @@ -66,8 +73,14 @@ func TestGenerateAndWriteSchemas(t *testing.T) { } fullpath := filepath.Join(path, filename) if err := os.WriteFile(fullpath, data, 0644); err != nil { - t.Fatal("Failed to write JSON schema to file") + t.Fatalf("Failed to write JSON schema to file: %s", fullpath) } - log.Println("Schema written") + log.Println("Schema written:", fullpath) + } + + if err := os.RemoveAll(path); err != nil { + t.Fatalf("Failed to remove schema directory: %s/%s", dir, path) + } else { + log.Printf("Removed: %s/%s\n", dir, path) } }