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

Generate empty test using /gen-test ChatOpts command #2005

Merged
merged 14 commits into from
Apr 13, 2023
  •  
  •  
  •  
78 changes: 78 additions & 0 deletions cmd/agent/core/ngt/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,81 @@

// 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 {
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 🐶
fieldalignment: struct with 40 pointer bytes could be 32 (govet)

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) {
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 🐶
parameter name 'tt' is too short for the scope of its usage (varnamelen)

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)
}
})
}
}
78 changes: 78 additions & 0 deletions cmd/agent/sidecar/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,81 @@

// 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 {
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 🐶
fieldalignment: struct with 40 pointer bytes could be 32 (govet)

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) {
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 🐶
parameter name 'tt' is too short for the scope of its usage (varnamelen)

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)
}
})
}
}
78 changes: 78 additions & 0 deletions cmd/discoverer/k8s/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,81 @@

// 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) {
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 🐶
parameter name 'tt' is too short for the scope of its usage (varnamelen)

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)
}
})
}
}
78 changes: 78 additions & 0 deletions cmd/gateway/filter/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,81 @@

// 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)
}
})
}
}
Loading