...

Source file src/edge-infra.dev/third_party/k8s/linkerd/helm/charts_test.go

Documentation: edge-infra.dev/third_party/k8s/linkerd/helm

     1  package helm
     2  
     3  import (
     4  	"path/filepath"
     5  	"testing"
     6  )
     7  
     8  func TestDirectoryStructure(t *testing.T) {
     9  	chartsDir, err := Templates.ReadDir("linkerd/charts")
    10  	if err != nil {
    11  		t.Error(err)
    12  	}
    13  
    14  	if len(chartsDir) == 0 {
    15  		t.Fatal("linkerd/charts/ directory empty in embedded filesystem")
    16  	}
    17  	if len(chartsDir) != 4 {
    18  		t.Fatal("linkerd/charts/ directory should only contain directories")
    19  	}
    20  	if chartsDir[0].Name() != "linkerd-control-plane" {
    21  		t.Fatal("linkerd/charts/linkerd-control-plane/ not present")
    22  	}
    23  	if chartsDir[1].Name() != "linkerd-crds" {
    24  		t.Fatal("linkerd/charts/linkerd-crds/ not present")
    25  	}
    26  	if chartsDir[2].Name() != "partials" {
    27  		t.Fatal("linkerd/charts/partials/ not present")
    28  	}
    29  	if chartsDir[3].Name() != "patch" {
    30  		t.Fatal("linkerd/charts/patch/ not present")
    31  	}
    32  
    33  	// test partials are all present
    34  	templates, err := Templates.ReadDir("linkerd/charts/partials/templates")
    35  	if err != nil {
    36  		t.Error(err)
    37  	}
    38  	if len(templates) == 0 {
    39  		t.Fatal("linkerd/charts/partials/templates is empty")
    40  	}
    41  
    42  	for _, e := range chartsDir {
    43  		t.Log(e.Name())
    44  		if !e.IsDir() {
    45  			t.Fatal("not a directory", e.Name())
    46  		}
    47  		_, err := Templates.ReadDir(filepath.Join("linkerd/charts", e.Name()))
    48  		if err != nil {
    49  			t.Error(err)
    50  		}
    51  	}
    52  }
    53  

View as plain text