github.com/bdwilliams/libcompose@v0.3.1-0.20160826154243-d81a9bdacff0/config/merge_fixtures_test.go (about)

     1  package config
     2  
     3  import (
     4  	"io/ioutil"
     5  	"path/filepath"
     6  	"strings"
     7  	"testing"
     8  )
     9  
    10  func TestMergeOnValidFixtures(t *testing.T) {
    11  	files, err := ioutil.ReadDir("testdata/")
    12  	if err != nil {
    13  		t.Fatal(err)
    14  	}
    15  	for _, file := range files {
    16  		if file.IsDir() || !strings.HasSuffix(file.Name(), ".yml") {
    17  			continue
    18  		}
    19  		data, err := ioutil.ReadFile(filepath.Join("testdata", file.Name()))
    20  		if err != nil {
    21  			t.Fatalf("error reading %q: %v", file.Name(), err)
    22  		}
    23  		_, _, _, _, err = Merge(NewServiceConfigs(), nil, nil, file.Name(), data, nil)
    24  		if err != nil {
    25  			t.Errorf("error loading %q: %v\n %v", file.Name(), string(data), err)
    26  		}
    27  	}
    28  }