github.com/openshift/installer@v1.4.17/data/unpack_test.go (about)

     1  package data
     2  
     3  import (
     4  	"bytes"
     5  	"os"
     6  	"path/filepath"
     7  	"testing"
     8  )
     9  
    10  func TestUnpack(t *testing.T) {
    11  	path := t.TempDir()
    12  
    13  	err := Unpack(path, ".")
    14  	if err != nil {
    15  		t.Fatal(err)
    16  	}
    17  
    18  	expected := "# Bootstrap Module"
    19  	content, err := os.ReadFile(filepath.Join(path, "libvirt", "bootstrap", "README.md"))
    20  	if err != nil {
    21  		t.Fatal(err)
    22  	}
    23  
    24  	firstLine := string(bytes.SplitN(content, []byte("\n"), 2)[0])
    25  	if firstLine != expected {
    26  		t.Fatalf("%q != %q", firstLine, expected)
    27  	}
    28  }