Skip to content

Commit

Permalink
Revert "Re-Generate test codes (#2107)"
Browse files Browse the repository at this point in the history
This reverts commit a6d8701.
  • Loading branch information
ykadowak committed Nov 30, 2023
1 parent 6df7788 commit 8d77239
Show file tree
Hide file tree
Showing 224 changed files with 147,621 additions and 115,121 deletions.
147 changes: 76 additions & 71 deletions cmd/agent/core/ngt/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,75 +17,80 @@
// Package main provides program main
package main

import (
"testing"

"github.com/vdaas/vald/internal/test/goleak"
)

// NOT IMPLEMENTED BELOW
//
// func Test_main(t *testing.T) {
// type want struct {
// }
// type test struct {
// name string
// want want
// checkFunc func(want) error
// beforeFunc func(*testing.T)
// afterFunc func(*testing.T)
// }
// defaultCheckFunc := func(w want) error {
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// main()
// if err := checkFunc(test.want); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }

func Test_main(t *testing.T) {
type want struct{}
type test struct {
name string
want want
checkFunc func(want) error
beforeFunc func(*testing.T)
afterFunc func(*testing.T)
}
defaultCheckFunc := func(w want) error {
return nil
}
tests := []test{
// TODO test cases
/*
{
name: "test_case_1",
want: want{},
checkFunc: defaultCheckFunc,
beforeFunc: func(t *testing.T,) {
t.Helper()
},
afterFunc: func(t *testing.T,) {
t.Helper()
},
},
*/

// TODO test cases
/*
func() test {
return test {
name: "test_case_2",
want: want{},
checkFunc: defaultCheckFunc,
beforeFunc: func(t *testing.T,) {
t.Helper()
},
afterFunc: func(t *testing.T,) {
t.Helper()
},
}
}(),
*/
}

for _, tc := range tests {
test := tc
t.Run(test.name, func(tt *testing.T) {
tt.Parallel()
defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
if test.beforeFunc != nil {
test.beforeFunc(tt)
}
if test.afterFunc != nil {
defer test.afterFunc(tt)
}
checkFunc := test.checkFunc
if test.checkFunc == nil {
checkFunc = defaultCheckFunc
}

main()
if err := checkFunc(test.want); err != nil {
tt.Errorf("error = %v", err)
}
})
}
}
147 changes: 76 additions & 71 deletions cmd/agent/sidecar/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,75 +17,80 @@
// Package main provides program main
package main

import (
"testing"

"github.com/vdaas/vald/internal/test/goleak"
)

// NOT IMPLEMENTED BELOW
//
// func Test_main(t *testing.T) {
// type want struct {
// }
// type test struct {
// name string
// want want
// checkFunc func(want) error
// beforeFunc func(*testing.T)
// afterFunc func(*testing.T)
// }
// defaultCheckFunc := func(w want) error {
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// main()
// if err := checkFunc(test.want); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }

func Test_main(t *testing.T) {
type want struct{}
type test struct {
name string
want want
checkFunc func(want) error
beforeFunc func(*testing.T)
afterFunc func(*testing.T)
}
defaultCheckFunc := func(w want) error {
return nil
}
tests := []test{
// TODO test cases
/*
{
name: "test_case_1",
want: want{},
checkFunc: defaultCheckFunc,
beforeFunc: func(t *testing.T,) {
t.Helper()
},
afterFunc: func(t *testing.T,) {
t.Helper()
},
},
*/

// TODO test cases
/*
func() test {
return test {
name: "test_case_2",
want: want{},
checkFunc: defaultCheckFunc,
beforeFunc: func(t *testing.T,) {
t.Helper()
},
afterFunc: func(t *testing.T,) {
t.Helper()
},
}
}(),
*/
}

for _, tc := range tests {
test := tc
t.Run(test.name, func(tt *testing.T) {
tt.Parallel()
defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
if test.beforeFunc != nil {
test.beforeFunc(tt)
}
if test.afterFunc != nil {
defer test.afterFunc(tt)
}
checkFunc := test.checkFunc
if test.checkFunc == nil {
checkFunc = defaultCheckFunc
}

main()
if err := checkFunc(test.want); err != nil {
tt.Errorf("error = %v", err)
}
})
}
}
Loading

0 comments on commit 8d77239

Please sign in to comment.