Skip to content

Commit

Permalink
cilium#2972: Debug
Browse files Browse the repository at this point in the history
Signed-off-by: Trung-DV <[email protected]>
  • Loading branch information
Trung-DV committed Nov 13, 2024
1 parent 05e4231 commit cf19ed8
Show file tree
Hide file tree
Showing 128 changed files with 531 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/vmtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- 'docs/**'
push:
branches:
- main
- '**'
paths-ignore:
- 'docs/**'

Expand Down
2 changes: 2 additions & 0 deletions api/v1/tetragon/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestResponseIsType(t *testing.T) {
t.Skip()
ger := GetEventsResponse{
Event: &GetEventsResponse_ProcessExec{},
}
Expand All @@ -20,6 +21,7 @@ func TestResponseIsType(t *testing.T) {
}

func TestEventIsType(t *testing.T) {
t.Skip()
event := ProcessExec{}

assert.True(t, EventType_PROCESS_EXEC.EventIsType(&event))
Expand Down
1 change: 1 addition & 0 deletions bpf/tests/prepend_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func NewPrependNameState(t *testing.T, stateMap *ebpf.Map) PrependNameState {
}

func Test_PrependName(t *testing.T) {
t.Skip()
// load test program
coll, err := ebpf.LoadCollection("objs/prepend_name_test.o")
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/tetra/common/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

func TestHumanizeByteCount(t *testing.T) {
t.Skip()
tests := []struct {
input int
want string
Expand Down
5 changes: 5 additions & 0 deletions cmd/tetra/getevents/getevents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

func Test_GetEvents_Namespaces(t *testing.T) {
t.Skip()
t.Run("FilterNothing", func(t *testing.T) {
testutils.MockPipedFile(t, testutils.RepoRootPath("testdata/events.json"))
cmd := New()
Expand All @@ -32,6 +33,7 @@ func Test_GetEvents_Namespaces(t *testing.T) {
}

func Test_GetEvents_EventTypes(t *testing.T) {
t.Skip()
t.Run("FilterProcessExec", func(t *testing.T) {
testutils.MockPipedFile(t, testutils.RepoRootPath("testdata/events.json"))
cmd := New()
Expand All @@ -57,6 +59,7 @@ func Test_GetEvents_EventTypes(t *testing.T) {
}

func Test_GetEvents_Pods(t *testing.T) {
t.Skip()
t.Run("FilterTie", func(t *testing.T) {
testutils.MockPipedFile(t, testutils.RepoRootPath("testdata/events.json"))
cmd := New()
Expand All @@ -75,6 +78,7 @@ func Test_GetEvents_Pods(t *testing.T) {
}

func Test_GetEvents_Processes(t *testing.T) {
t.Skip()
t.Run("FilterNetserver", func(t *testing.T) {
testutils.MockPipedFile(t, testutils.RepoRootPath("testdata/events.json"))
cmd := New()
Expand All @@ -93,6 +97,7 @@ func Test_GetEvents_Processes(t *testing.T) {
}

func Test_GetEvents_FilterFields(t *testing.T) {
t.Skip()
t.Run("ExcludeParent", func(t *testing.T) {
testutils.MockPipedFile(t, testutils.RepoRootPath("testdata/events.json"))
cmd := New()
Expand Down
1 change: 1 addition & 0 deletions cmd/tetra/getevents/io_reader_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

func Test_ioReaderClient_GetEvents(t *testing.T) {
t.Skip()
events, err := os.Open(testutils.RepoRootPath("testdata/events.json"))
assert.NoError(t, err)
client := newIOReaderClient(events, false)
Expand Down
1 change: 1 addition & 0 deletions cmd/tetra/probe/probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func Test_ProbeCommand(t *testing.T) {
t.Skip()
cmd := New()
cmdOutput := &bytes.Buffer{}
cmd.SetOut(cmdOutput)
Expand Down
1 change: 1 addition & 0 deletions cmd/tetragon/conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@ func runTestCases(t *testing.T) {
}

func TestReadConfigSettings(t *testing.T) {
t.Skip()
for i, c := range testCases {
globalTestIndex = i
rootCmd := &cobra.Command{
Expand Down
1 change: 1 addition & 0 deletions cmd/tetragon/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestMain(m *testing.M) {
// when it observer is ready. By that time we should have
// exec events generated, make sure it's done.
func TestGeneratedExecEvents(t *testing.T) {
t.Skip()
ctx, cancel := context.WithCancel(context.Background())
ready := func() {
cancel()
Expand Down
1 change: 1 addition & 0 deletions contrib/tetragon-rthooks/cmd/oci-hook/cel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func celAllowNamespacesNoError(t *testing.T, vals []string) *celProg {
}

func TestCel(t *testing.T) {
t.Skip()
type testCase struct {
prog *celProg
expectedVal interface{}
Expand Down
1 change: 1 addition & 0 deletions operator/podinfo/podinfo_controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,6 @@ func (suite *ControllerTestSuite) TearDownSuite() {
}

func TestControllerSuite(t *testing.T) {
t.Skip()
suite.Run(t, new(ControllerTestSuite))
}
5 changes: 5 additions & 0 deletions operator/podinfo/podinfo_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func randomPodGenerator() *corev1.Pod {

// TestGeneratePod tests if the corresponding podInfo CR generated for a pod is same when using generatePodInfo function
func TestGeneratePod(t *testing.T) {
t.Skip()
t.Run("Testing Object Meta", func(t *testing.T) {
pod := randomPodGenerator()
controller := true
Expand Down Expand Up @@ -153,6 +154,7 @@ func TestGeneratePod(t *testing.T) {

// TestHasAllRequiredFields checks if a pod is ready or not.
func TestHasAllRequiredFields(t *testing.T) {
t.Skip()
t.Run("Check if all the necessary fields of pod are available", func(t *testing.T) {

// test ready pod.
Expand Down Expand Up @@ -196,6 +198,7 @@ func TestHasAllRequiredFields(t *testing.T) {

// TestEqual checks if controller function checkIfChanged returns true if the Pod is changed and false if it did not change.
func TestEqual(t *testing.T) {
t.Skip()
t.Run("Check if the pod and podInfo are different", func(t *testing.T) {
// All fields match
t.Run("All fields same", func(*testing.T) {
Expand Down Expand Up @@ -284,6 +287,7 @@ func TestEqual(t *testing.T) {
}

func TestReconcile(t *testing.T) {
t.Skip()
pod := randomPodGenerator()
client := getClientBuilder().WithObjects(pod).Build()
reconciler := Reconciler{client}
Expand All @@ -295,6 +299,7 @@ func TestReconcile(t *testing.T) {
}

func TestReconcileWithDeletionTimestamp(t *testing.T) {
t.Skip()
pod := randomPodGenerator()
pod.SetFinalizers([]string{"finalize-it"})
deletionTimestamp := metav1.Now()
Expand Down
1 change: 1 addition & 0 deletions pkg/aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func Test_getNameOrIp(t *testing.T) {
t.Skip()
assert.Equal(t, "1.1.1.1", getNameOrIp("1.1.1.1", []string{}))
assert.Equal(t, "a.com,b.com,c.com", getNameOrIp("1.1.1.1", []string{"b.com", "c.com", "a.com"}))
}
1 change: 1 addition & 0 deletions pkg/alignchecker/alignchecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func init() {
}

func Test_Alignments(t *testing.T) {
t.Skip()
bpfObjPath := filepath.Join(tetragonLib, "bpf_alignchecker.o")

err := CheckStructAlignments(bpfObjPath)
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/ops/ops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

func TestCgroupOpCode(t *testing.T) {
t.Skip()
testcases := map[CgroupOpCode]string{
MSG_OP_CGROUP_UNDEF: "Undef",
MSG_OP_CGROUP_MKDIR: "CgroupMkdir",
Expand All @@ -24,6 +25,7 @@ func TestCgroupOpCode(t *testing.T) {
}

func TestCgroupState(t *testing.T) {
t.Skip()
testcases := map[CgroupState]string{
CGROUP_UNTRACKED: "Untracked",
CGROUP_NEW: "New",
Expand Down
1 change: 1 addition & 0 deletions pkg/arch/arch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func Test_addSyscallPrefix(t *testing.T) {
t.Skip()
symbol := "sys_test"
arch := "test64"
supportedArchPrefix[arch] = "__test64_"
Expand Down
1 change: 1 addition & 0 deletions pkg/bpf/maps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func Benchmark_parseMemlockFromFDInfoReader(b *testing.B) {
}

func Test_parseMemlockFromFDInfoReader(t *testing.T) {
t.Skip()
tests := []struct {
name string
args io.Reader
Expand Down
3 changes: 3 additions & 0 deletions pkg/btf/btf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func setupfiles() func(*testing.T, string, ...string) {
}

func TestObserverFindBTF(t *testing.T) {
t.Skip()
tmpdir := t.TempDir()

old := os.Getenv("TETRAGON_BTF")
Expand Down Expand Up @@ -78,6 +79,7 @@ func TestObserverFindBTF(t *testing.T) {
}

func TestObserverFindBTFEnv(t *testing.T) {
t.Skip()
old := os.Getenv("TETRAGON_BTF")
defer os.Setenv("TETRAGON_BTF", old)

Expand Down Expand Up @@ -142,6 +144,7 @@ func TestObserverFindBTFEnv(t *testing.T) {
}

func TestInitCachedBTF(t *testing.T) {
t.Skip()
_, err := os.Stat(defaults.DefaultBTFFile)
if err != nil {
btffile := os.Getenv("TETRAGON_BTF")
Expand Down
2 changes: 2 additions & 0 deletions pkg/btf/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var testFiles = []struct {
}

func TestSpecs(t *testing.T) {
t.Skip()
_, testFname, _, _ := runtime.Caller(0)
testdataPath := filepath.Join(filepath.Dir(testFname), "..", "..", "testdata")

Expand Down Expand Up @@ -82,6 +83,7 @@ func TestSpecs(t *testing.T) {
}

func TestEnum(t *testing.T) {
t.Skip()
require.Equal(t,
getKernelType(&btf.Enum{
Size: 2,
Expand Down
3 changes: 3 additions & 0 deletions pkg/bugtool/bugtool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

func TestSaveAndLoad(t *testing.T) {
t.Skip()

tmpFile, err := os.CreateTemp(t.TempDir(), "tetragon-bugtool-test-")
if err != nil {
Expand Down Expand Up @@ -46,6 +47,7 @@ func TestSaveAndLoad(t *testing.T) {
}

func Test_findCgroupMountPath(t *testing.T) {
t.Skip()
const cgroupMountsHybrid = `tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
Expand Down Expand Up @@ -150,6 +152,7 @@ bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0`
}

func Test_findMemoryCgroupPath(t *testing.T) {
t.Skip()
tests := []struct {
name string
args io.Reader
Expand Down
1 change: 1 addition & 0 deletions pkg/bugtool/maps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestMain(m *testing.M) {
}

func TestFindMaps(t *testing.T) {
t.Skip()
t.Run("NoSuchFile", func(t *testing.T) {
const path = "/sys/fs/bpf/nosuchfile"
_, err := FindPinnedMaps(path)
Expand Down
1 change: 1 addition & 0 deletions pkg/bugtool/multilog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func TestMultiLog(t *testing.T) {
t.Skip()

fmt := logrus.TextFormatter{
DisableColors: true,
Expand Down
2 changes: 2 additions & 0 deletions pkg/cgrouprate/cgrouprate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type testData struct {
}

func TestProcessCgroup(t *testing.T) {
t.Skip()
key := processapi.CgroupRateKey{
Id: 123,
}
Expand Down Expand Up @@ -260,6 +261,7 @@ func TestProcessCgroup(t *testing.T) {
}

func TestParseCgroupRate(t *testing.T) {
t.Skip()
var opt option.CgroupRate

// ok
Expand Down
11 changes: 11 additions & 0 deletions pkg/cgroups/cgroups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func isDirMountFsType(path string, mntType string) (bool, error) {
}

func TestCgroupNameFromCStr(t *testing.T) {
t.Skip()
type progTest struct {
in []byte
want string
Expand Down Expand Up @@ -104,6 +105,7 @@ func TestCgroupNameFromCStr(t *testing.T) {

// Ensure that Cgroupv1 controllers discovery fails if no 'cpuset' and no 'memory'
func TestParseCgroupSubSysIdsWithoutMemoryCpuset(t *testing.T) {
t.Skip()
testDir := t.TempDir()
invalid_cgroupv1_controllers :=
`
Expand All @@ -123,6 +125,7 @@ perf_event 8 2 1
}

func TestParseCgroupSubSysIds(t *testing.T) {
t.Skip()

testDir := t.TempDir()

Expand Down Expand Up @@ -165,6 +168,7 @@ misc 10 1 1
}

func TestCheckCgroupv2Controllers(t *testing.T) {
t.Skip()
testDir := t.TempDir()
empty_controllers := ""

Expand All @@ -185,13 +189,15 @@ func TestCheckCgroupv2Controllers(t *testing.T) {

// Test cgroup mode detection on an invalid directory
func TestDetectCgroupModeInvalid(t *testing.T) {
t.Skip()
mode, err := detectCgroupMode("invalid-cgroupfs-path")
assert.Error(t, err)
assert.Equal(t, CGROUP_UNDEF, mode)
}

// Test cgroup mode detection on default cgroup root /sys/fs/cgroup
func TestDetectCgroupModeDefault(t *testing.T) {
t.Skip()
var st syscall.Statfs_t

err := syscall.Statfs(defaultCgroupRoot, &st)
Expand Down Expand Up @@ -225,6 +231,7 @@ func TestDetectCgroupModeDefault(t *testing.T) {

// Test cgroup mode detection on our custom location /run/tetragon/cgroup2
func TestDetectCgroupModeCustomLocation(t *testing.T) {
t.Skip()
// We also mount cgroup2 on /run/tetragon/cgroup2 let's test it
mounted, err := isDirMountFsType(defaults.Cgroup2Dir, mountinfo.FilesystemTypeCgroup2)
assert.NoError(t, err)
Expand All @@ -246,6 +253,7 @@ func TestDetectCgroupModeCustomLocation(t *testing.T) {
// calls to DetectCgroupMode() will just return cgroupMode, so ensure
// they are properly set.
func TestDetectCgroupMode(t *testing.T) {
t.Skip()
mode, err := DetectCgroupMode()
assert.NoError(t, err)
assert.NotEqual(t, CGROUP_UNDEF, mode)
Expand All @@ -260,6 +268,7 @@ func TestDetectCgroupMode(t *testing.T) {
//
// TODO Setup multiple cgroupv1 and cgroupv2 combinations
func TestDetectCgroupFSMagic(t *testing.T) {
t.Skip()
fs, err := DetectCgroupFSMagic()
assert.NoError(t, err)
assert.NotEqual(t, CGROUP_UNDEF, fs)
Expand Down Expand Up @@ -288,6 +297,7 @@ func TestDetectCgroupFSMagic(t *testing.T) {
// - Their hierarchy IDs
// - Their css index
func TestDiscoverCgroupv1SubSysIdsDefault(t *testing.T) {
t.Skip()
fs, err := DetectCgroupFSMagic()
assert.NoError(t, err)
assert.NotEqual(t, CGROUP_UNDEF, fs)
Expand Down Expand Up @@ -327,6 +337,7 @@ func TestDiscoverCgroupv1SubSysIdsDefault(t *testing.T) {
}

func TestGetCgroupIdFromPath(t *testing.T) {
t.Skip()
mode, err := DetectCgroupMode()
assert.NoError(t, err)
assert.NotEqual(t, CGROUP_UNDEF, mode)
Expand Down
Loading

0 comments on commit cf19ed8

Please sign in to comment.