Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-Generate test codes #2107

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 71 additions & 76 deletions cmd/agent/core/ngt/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,80 +17,75 @@
// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Duplicate words (want) found (dupword)

// 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: 71 additions & 76 deletions cmd/agent/sidecar/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,80 +17,75 @@
// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Duplicate words (want) found (dupword)

// 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