package raid_test import ( "fmt" "testing" "imuslab.com/arozos/mod/disk/raid" ) func TestCreateRAIDDevice(t *testing.T) { //Create an empty Manager manager, _ := raid.NewRaidManager(raid.Options{}) // Make sure the loop0 and loop1 devies are mounted with automount.sh devName, _ := raid.GetNextAvailableMDDevice() raidLevel := 1 raidDeviceIds := []string{"/dev/loop0", "/dev/loop1"} spareDeviceIds := []string{} //Format the drives for _, partion := range raidDeviceIds { fmt.Printf("Wiping partition: " + partion) err := manager.WipeDisk(partion) if err != nil { t.Errorf("Disk wipe error: %v", err) } } // Call the function being tested err := manager.CreateRAIDDevice(devName, raidLevel, raidDeviceIds, spareDeviceIds) if err != nil { t.Errorf("Unexpected error: %v", err) } fmt.Println("RAID array created") }