-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from jt-nti/service-account
Add service account configuration
- Loading branch information
Showing
24 changed files
with
324 additions
and
51 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
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
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
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
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
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 |
---|---|---|
@@ -1,27 +1,76 @@ | ||
package main_test | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
"time" | ||
|
||
"github.com/bitfield/script" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/onsi/gomega/gexec" | ||
) | ||
|
||
//nolint:gochecknoglobals // not sure how to avoid this | ||
var runCmdPath string | ||
var ( | ||
includeKindTests bool | ||
runCmdPath string | ||
) | ||
|
||
func TestRun(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Run Suite") | ||
|
||
suiteConfig, _ := GinkgoConfiguration() | ||
|
||
kindEnv := os.Getenv("INCLUDE_KIND_TESTS") | ||
if kindEnv == "true" { | ||
includeKindTests = true | ||
} else { | ||
includeKindTests = false | ||
} | ||
|
||
if !includeKindTests { | ||
if suiteConfig.LabelFilter == "" { | ||
suiteConfig.LabelFilter = "!kind" | ||
} else { | ||
suiteConfig.LabelFilter = "(" + suiteConfig.LabelFilter + ") && !kind" | ||
} | ||
} | ||
|
||
RunSpecs(t, "Run Suite", suiteConfig) | ||
} | ||
|
||
var _ = BeforeSuite(func() { | ||
SetDefaultEventuallyTimeout(2 * time.Second) | ||
|
||
var err error | ||
runCmdPath, err = gexec.Build("github.com/hyperledger-labs/fabric-builder-k8s/cmd/run") | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
if includeKindTests { | ||
script.Exec("kind delete cluster --name fabric-builder-k8s-test") | ||
|
||
pipe := script.Exec("kind create cluster --name fabric-builder-k8s-test") | ||
_, err = pipe.Stdout() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(pipe.ExitStatus()).To(Equal(0)) | ||
|
||
pipe = script.Exec("kubectl create namespace chaincode") | ||
_, err = pipe.Stdout() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(pipe.ExitStatus()).To(Equal(0)) | ||
|
||
pipe = script.Exec("kubectl create serviceaccount chaincode --namespace=chaincode") | ||
_, err = pipe.Stdout() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(pipe.ExitStatus()).To(Equal(0)) | ||
} | ||
}) | ||
|
||
var _ = AfterSuite(func() { | ||
gexec.CleanupBuildArtifacts() | ||
if includeKindTests { | ||
_, err := script.Exec("kind delete cluster --name fabric-builder-k8s-test").Stdout() | ||
Expect(err).NotTo(HaveOccurred()) | ||
} | ||
}) |
Oops, something went wrong.