Blame internal/osbuild1/fstab_stage_test.go

Packit Service 15f37d
package osbuild1
Packit Service 15f37d
Packit Service 15f37d
import (
Packit Service 15f37d
	"testing"
Packit Service 15f37d
Packit Service 15f37d
	"github.com/stretchr/testify/assert"
Packit Service 15f37d
)
Packit Service 15f37d
Packit Service 15f37d
func TestNewFSTabStage(t *testing.T) {
Packit Service 15f37d
	expectedStage := &Stage{
Packit Service 15f37d
		Name:    "org.osbuild.fstab",
Packit Service 15f37d
		Options: &FSTabStageOptions{},
Packit Service 15f37d
	}
Packit Service 15f37d
	actualStage := NewFSTabStage(&FSTabStageOptions{})
Packit Service 15f37d
	assert.Equal(t, expectedStage, actualStage)
Packit Service 15f37d
}
Packit Service 15f37d
Packit Service 15f37d
func TestAddFilesystem(t *testing.T) {
Packit Service 15f37d
	options := &FSTabStageOptions{}
Packit Service 15f37d
	filesystems := []*FSTabEntry{
Packit Service 15f37d
		{
Packit Service 15f37d
			UUID:    "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
Packit Service 15f37d
			VFSType: "ext4",
Packit Service 15f37d
			Path:    "/",
Packit Service 15f37d
			Options: "defaults",
Packit Service 15f37d
			Freq:    1,
Packit Service 15f37d
			PassNo:  1,
Packit Service 15f37d
		},
Packit Service 15f37d
		{
Packit Service 15f37d
			UUID:    "bba22bf4-f153-4541-b6c7-0332c0dfaeac",
Packit Service 15f37d
			VFSType: "xfs",
Packit Service 15f37d
			Path:    "/home",
Packit Service 15f37d
			Options: "defaults",
Packit Service 15f37d
			Freq:    1,
Packit Service 15f37d
			PassNo:  2,
Packit Service 15f37d
		},
Packit Service 15f37d
		{
Packit Service 15f37d
			UUID:    "cca22bf4-f153-4541-b6c7-0332c0dfaeac",
Packit Service 15f37d
			VFSType: "xfs",
Packit Service 15f37d
			Path:    "/var",
Packit Service 15f37d
			Options: "defaults",
Packit Service 15f37d
			Freq:    1,
Packit Service 15f37d
			PassNo:  1,
Packit Service 15f37d
		},
Packit Service 15f37d
	}
Packit Service 15f37d
Packit Service 15f37d
	for i, fs := range filesystems {
Packit Service 15f37d
		options.AddFilesystem(fs.UUID, fs.VFSType, fs.Path, fs.Options, fs.Freq, fs.PassNo)
Packit Service 15f37d
		assert.Equal(t, options.FileSystems[i], fs)
Packit Service 15f37d
	}
Packit Service 15f37d
	assert.Equal(t, len(filesystems), len(options.FileSystems))
Packit Service 15f37d
}