| 1 |
// Copyright 2019 The Kubernetes Authors. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package krusty_test |
| 5 |
|
| 6 |
import ( |
| 7 |
"strings" |
| 8 |
"testing" |
| 9 |
|
| 10 |
"sigs.k8s.io/kustomize/api/krusty" |
| 11 |
"sigs.k8s.io/kustomize/kyaml/filesys" |
| 12 |
) |
| 13 |
|
| 14 |
// A simple usage example to shows what happens when |
| 15 |
// there are no files to read. |
| 16 |
// For more substantial tests and examples, |
| 17 |
// see other tests in this package. |
| 18 |
func TestEmptyFileSystem(t *testing.T) { |
| 19 |
b := krusty.MakeKustomizer(krusty.MakeDefaultOptions()) |
| 20 |
_, err := b.Run(filesys.MakeFsInMemory(), "noSuchThing") |
| 21 |
if err == nil { |
| 22 |
t.Fatalf("expected error") |
| 23 |
} |
| 24 |
if !strings.Contains(err.Error(), "'noSuchThing' doesn't exist") { |
| 25 |
t.Fatalf("unexpected error: %v", err) |
| 26 |
} |
| 27 |
} |