Skip to content

Commit

Permalink
Merge pull request #12 from kris-nova/fixing-tests
Browse files Browse the repository at this point in the history
Fixing tests... oh baby
  • Loading branch information
krisnova authored Jun 21, 2021
2 parents 858eb74 + 9662a0e commit 220e0fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
14 changes: 6 additions & 8 deletions apps/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
package apps

import (
"github.com/kris-nova/logger"
yamyams "github.com/kris-nova/yamyams/pkg"
"os"
"testing"

"github.com/kris-nova/logger"
yamyams "github.com/kris-nova/yamyams/pkg"
)

func TestMain(m *testing.M) {
Expand All @@ -35,10 +36,7 @@ func TestMain(m *testing.M) {
logger.Critical(err.Error())
os.Exit(1)
}
os.Exit(m.Run())
err = yamyams.TestClusterStop()
if err != nil {
logger.Critical(err.Error())
os.Exit(2)
}
q := m.Run()
yamyams.TestClusterStop()
os.Exit(q)
}
3 changes: 2 additions & 1 deletion apps/sampleapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package sampleapp
import (
"context"
"fmt"

yamyams "github.com/kris-nova/yamyams/pkg"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -53,7 +54,7 @@ func New(namespace string, name string, exampleString string, exampleInt int) *M
"k8s-app": "mysampleapp",
"app": "mysampleapp",
"example-label": exampleString,
"description": "the 'description' label is special to YamYams and if this is set it will be used in <yamyams list>.",
"description": "short-description-of-your-app",
},
Annotations: map[string]string{
"beeps": "boops",
Expand Down
4 changes: 3 additions & 1 deletion pkg/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ package yamyams

import (
"fmt"
"k8s.io/client-go/util/homedir"
"path"

"k8s.io/client-go/util/homedir"
"sigs.k8s.io/kind/pkg/cluster"
"sigs.k8s.io/kind/pkg/cmd"
)
Expand All @@ -48,6 +49,7 @@ func TestClusterStart() error {
provider := cluster.NewProvider(cluster.ProviderWithDocker(), cluster.ProviderWithLogger(cmd.NewLogger()))
err := provider.Create(TestClusterName)
if err != nil {
defer TestClusterStop()
return fmt.Errorf("unable to create kind test cluster: %v", err)
}
err = provider.ExportKubeConfig(TestClusterName, kubeConfigPath)
Expand Down

0 comments on commit 220e0fa

Please sign in to comment.