-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* gitignore fixup * add license header to files * import whole auth package, not just azure and gcp * examples for tap interface. These will probably change in the future but it's a start * mitmproxy tests broken out, function renames
Matt Hamilton
committed
May 30, 2020
1 parent
6a47445
commit c29e47a
Showing
6 changed files
with
79 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,8 @@ ci.mod | |
ci.sum | ||
ig-tests.mod | ||
ig-tests.sum | ||
docs/_book/ | ||
*_original | ||
site/ | ||
.vim/ | ||
venv/ | ||
coverage.* | ||
krew/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2020 Soluble Inc | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package main | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"k8s.io/client-go/kubernetes/fake" | ||
) | ||
|
||
func Test_DestroyMitmproxyConfigMap(t *testing.T) { | ||
tests := []struct { | ||
Name string | ||
ServiceName string | ||
ClientFunc func() *fake.Clientset | ||
Err error | ||
}{ | ||
{"simple", "sample-service", fakeClientTappedSimple, nil}, | ||
{"untapped", "sample-service", fakeClientUntappedSimple, ErrConfigMapNoMatch}, | ||
{"no_svc_name", "", fakeClientTappedSimple, os.ErrInvalid}, | ||
{"missing_annotations", "sample-service", fakeClientTappedWithoutAnnotations, ErrConfigMapNoMatch}, | ||
} | ||
for _, tc := range tests { | ||
t.Run(tc.Name, func(t *testing.T) { | ||
require := require.New(t) | ||
fakeClient := tc.ClientFunc() | ||
cmClient := fakeClient.CoreV1().ConfigMaps("default") | ||
err := destroyMitmproxyConfigMap(cmClient, tc.ServiceName) | ||
if tc.Err != nil { | ||
require.NotNil(err) | ||
require.True(errors.Is(err, tc.Err)) | ||
} else { | ||
require.Nil(err) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters