github.com/ijc/docker-app@v0.6.1-0.20181012090447-c7ca8bc483fb/e2e/example_test.go (about)

     1  package e2e
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  	"strings"
     7  	"testing"
     8  
     9  	"gotest.tools/assert"
    10  	"gotest.tools/icmd"
    11  )
    12  
    13  func TestExamplesAreValid(t *testing.T) {
    14  	err := filepath.Walk("../examples", func(p string, info os.FileInfo, err error) error {
    15  		switch {
    16  		case strings.HasSuffix(p, "examples"):
    17  			return nil
    18  		case strings.HasSuffix(p, ".resources"):
    19  			return filepath.SkipDir
    20  		case !info.IsDir():
    21  			return nil
    22  		default:
    23  			result := icmd.RunCommand(dockerApp, "validate", filepath.Join(p, filepath.Base(p)+".dockerapp"))
    24  			result.Assert(t, icmd.Success)
    25  			return filepath.SkipDir
    26  		}
    27  	})
    28  	assert.NilError(t, err)
    29  }