Refactor: remove unused mock and files

This commit is contained in:
Hidetake Iwata
2020-05-11 20:41:24 +09:00
parent 582ca48092
commit c5621239e8
3 changed files with 8 additions and 32 deletions

View File

@@ -86,6 +86,10 @@ type credentialPluginTestCase struct {
func testCredentialPlugin(t *testing.T, tc credentialPluginTestCase) {
timeout := 1 * time.Second
var (
tokenExpiryFuture = time.Now().Add(time.Hour).Round(time.Second)
tokenExpiryPast = time.Now().Add(-time.Hour).Round(time.Second)
)
t.Run("Defaults", func(t *testing.T) {
t.Parallel()

View File

@@ -1,10 +0,0 @@
package integration_test
import (
"time"
)
var (
tokenExpiryFuture = time.Now().Add(time.Hour).Round(time.Second)
tokenExpiryPast = time.Now().Add(-time.Hour).Round(time.Second)
)

View File

@@ -6,7 +6,6 @@ import (
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/int128/kubelogin/integration_test/httpdriver"
"github.com/int128/kubelogin/integration_test/keypair"
"github.com/int128/kubelogin/integration_test/kubeconfig"
@@ -35,14 +34,15 @@ func TestStandalone(t *testing.T) {
func testStandalone(t *testing.T, idpTLS keypair.KeyPair) {
timeout := 5 * time.Second
var (
tokenExpiryFuture = time.Now().Add(time.Hour).Round(time.Second)
tokenExpiryPast = time.Now().Add(-time.Hour).Round(time.Second)
)
t.Run("Defaults", func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
server := oidcserver.New(t, oidcserver.Config{
TLS: idpTLS,
IDTokenExpiry: tokenExpiryFuture,
@@ -69,9 +69,6 @@ func testStandalone(t *testing.T, idpTLS keypair.KeyPair) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
server := oidcserver.New(t, oidcserver.Config{
TLS: idpTLS,
IDTokenExpiry: tokenExpiryFuture,
@@ -102,9 +99,6 @@ func testStandalone(t *testing.T, idpTLS keypair.KeyPair) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
server := oidcserver.New(t, oidcserver.Config{
TLS: idpTLS,
IDTokenExpiry: tokenExpiryFuture,
@@ -140,9 +134,6 @@ func testStandalone(t *testing.T, idpTLS keypair.KeyPair) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
server := oidcserver.New(t, oidcserver.Config{
TLS: idpTLS,
IDTokenExpiry: tokenExpiryFuture,
@@ -177,9 +168,6 @@ func testStandalone(t *testing.T, idpTLS keypair.KeyPair) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
server := oidcserver.New(t, oidcserver.Config{
TLS: idpTLS,
IDTokenExpiry: tokenExpiryFuture,
@@ -215,9 +203,6 @@ func testStandalone(t *testing.T, idpTLS keypair.KeyPair) {
// do not run this in parallel due to change of the env var
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
server := oidcserver.New(t, oidcserver.Config{
TLS: idpTLS,
IDTokenExpiry: tokenExpiryFuture,
@@ -246,9 +231,6 @@ func testStandalone(t *testing.T, idpTLS keypair.KeyPair) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
server := oidcserver.New(t, oidcserver.Config{
TLS: idpTLS,
IDTokenExpiry: tokenExpiryFuture,