2022-08-09 14:44:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-06-13 08:59:58 +02:00
|
|
|
"fmt"
|
|
|
|
"os"
|
2024-06-17 08:51:27 +02:00
|
|
|
"strings"
|
2022-12-21 14:40:35 +01:00
|
|
|
"testing"
|
2024-05-30 06:10:59 -04:00
|
|
|
"time"
|
2022-08-09 14:44:47 +00:00
|
|
|
|
2024-06-14 09:32:39 +02:00
|
|
|
. "fd.io/hs-test/infra"
|
2024-03-14 11:42:55 -04:00
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
|
|
. "github.com/onsi/gomega"
|
2022-08-09 14:44:47 +00:00
|
|
|
)
|
|
|
|
|
2024-03-14 11:42:55 -04:00
|
|
|
func TestHst(t *testing.T) {
|
2024-06-14 09:32:39 +02:00
|
|
|
if *IsVppDebug {
|
2024-05-30 06:10:59 -04:00
|
|
|
// 30 minute timeout so that the framework won't timeout while debugging
|
2024-10-15 14:56:16 +02:00
|
|
|
TestTimeout = time.Minute * 30
|
2024-05-30 06:10:59 -04:00
|
|
|
} else {
|
2024-10-15 14:56:16 +02:00
|
|
|
TestTimeout = time.Minute * 5
|
2024-05-30 06:10:59 -04:00
|
|
|
}
|
2024-06-13 08:59:58 +02:00
|
|
|
|
2024-06-17 08:51:27 +02:00
|
|
|
output, err := os.ReadFile("/sys/devices/system/node/online")
|
|
|
|
if err == nil && strings.Contains(string(output), "-") {
|
|
|
|
NumaAwareCpuAlloc = true
|
|
|
|
}
|
2024-06-13 08:59:58 +02:00
|
|
|
// creates a file with PPID, used for 'make cleanup-hst'
|
|
|
|
ppid := fmt.Sprint(os.Getppid())
|
|
|
|
ppid = ppid[:len(ppid)-1]
|
|
|
|
f, _ := os.Create(".last_hst_ppid")
|
|
|
|
f.Write([]byte(ppid))
|
|
|
|
f.Close()
|
|
|
|
|
2024-03-14 11:42:55 -04:00
|
|
|
RegisterFailHandler(Fail)
|
|
|
|
RunSpecs(t, "HST")
|
2024-09-25 14:49:11 +02:00
|
|
|
if *DryRun || *IsPersistent {
|
|
|
|
fmt.Println("\033[36m" + "Use 'make cleanup-hst' to remove IP files, " +
|
|
|
|
"namespaces and containers. \nPPID: " + ppid + "\033[0m")
|
|
|
|
}
|
2023-02-27 13:22:45 +01:00
|
|
|
}
|