Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
azak-azkaran committed Jun 30, 2021
1 parent 7dc1bed commit 856b96f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ jobs:
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=cover.out -service="github"
run: make coverall
working-directory: src/github.com/azak-azkaran/k8s-config
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/azak-azkaran/dev-edge-config
module github.com/azak-azkaran/k8s-config

go 1.15

Expand Down
13 changes: 6 additions & 7 deletions kubeconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"gopkg.in/yaml.v2"
)

func CleanUp(){
func CleanUpKubernetesTest() {
os.Rename("./test/config1.yml.backup", "./test/config1.yml")
os.Rename("./test/config2.yml.backup", "./test/config2.yml")
}

func TestUpdateGlobalConfig(t *testing.T) {
t.Cleanup(CleanUp)
t.Cleanup(CleanUpKubernetesTest)
LogConfig.Level.SetLevel(zap.DebugLevel)
Sugar.Info("Test: UpdateGlobalConfig")

Expand All @@ -32,20 +32,19 @@ func TestUpdateGlobalConfig(t *testing.T) {
require.NotEmpty(t, conf)

added := false
for _, context := range conf.Contexts{
if context.Name == k8sconfig.CurrentContext{
for _, context := range conf.Contexts {
if context.Name == k8sconfig.CurrentContext {
added = true
}
}
assert.True(t, added)


conf = UpdateGlobalConfig("./test/config2.yml", &k8sconfig)
require.NotEmpty(t, conf)

changed := false
for _, context := range conf.Contexts{
if context.Name == k8sconfig.CurrentContext && context.Context.User == k8sconfig.Contexts[0].Context.User{
for _, context := range conf.Contexts {
if context.Name == k8sconfig.CurrentContext && context.Context.User == k8sconfig.Contexts[0].Context.User {
changed = true
}
}
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ coverage: fetch

coverall: coverage
@echo Running Test with Coverall
goveralls -coverprofile=cover.out -service=travis-ci -repotoken=${COVERALLS_TOKEN }
goveralls -coverprofile=cover.out -service="github" -repotoken=${COVERALLS_TOKEN}

install: fetch
@echo Installing package
go install
go install
17 changes: 17 additions & 0 deletions openshiftconfig_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import (
"testing"

"go.uber.org/zap"
)

func CleanUpOpenshiftTest() {
}

func TestOpenshiftConfig(t *testing.T) {
t.Cleanup(CleanUpOpenshiftTest)
LogConfig.Level.SetLevel(zap.DebugLevel)
Sugar.Info("Test: UpdateGlobalConfig")

}

0 comments on commit 856b96f

Please sign in to comment.