Add travis CICD coverage.
Also, rename "kexpand" to "kinflate" to ease pronunciation.
This commit is contained in:
parent
4774644b76
commit
e7cac07c74
|
|
@ -0,0 +1,17 @@
|
||||||
|
language: go
|
||||||
|
|
||||||
|
go:
|
||||||
|
- 1.9.x
|
||||||
|
|
||||||
|
go_import_path: k8s.io/kubectl
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- go get -u github.com/golang/lint/golint
|
||||||
|
- go get -u golang.org/x/tools/cmd/goimports
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./bin/pre-commit.sh
|
||||||
|
|
||||||
|
# TBD, suppressing for now.
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -n "$failIt" ]; then
|
||||||
|
echo "Expecting failIt to be empty."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp=$(gofmt -s -d -l . 2>&1 )
|
||||||
|
if [ -n "$tmp" ]; then
|
||||||
|
printf >&2 'gofmt failed for:\n%s\n' "$tmp"
|
||||||
|
failIt=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp=$(goimports -l .)
|
||||||
|
if [ -n "$tmp" ]; then
|
||||||
|
printf >&2 'goimports failed for:\n%s\n' "$tmp"
|
||||||
|
failIt=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp=$(go vet -all ./... 2>&1)
|
||||||
|
if [ -n "$tmp" ]; then
|
||||||
|
printf >&2 'govet failed for:\n%s\n' "$tmp"
|
||||||
|
failIt=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp=$(golint ./...)
|
||||||
|
if [ -n "$tmp" ]; then
|
||||||
|
printf >&2 'golint failed for:\n%s\n' "$tmp"
|
||||||
|
failIt=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$failIt" ]; then
|
||||||
|
unset failIt
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
go test -v ./...
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# kexpand
|
# kinflate
|
||||||
|
|
||||||
_TODO: flesh out this placeholder documentation_
|
_TODO: flesh out this placeholder documentation_
|
||||||
|
|
||||||
`kexpand` is a kubernetes cluster configuration utility,
|
`kinflate` is a kubernetes cluster configuration utility,
|
||||||
a prototype of ideas discussed in [this doc][DAM].
|
a prototype of ideas discussed in [this doc][DAM].
|
||||||
|
|
||||||
It accepts one or more file system path arguments,
|
It accepts one or more file system path arguments,
|
||||||
|
|
@ -29,7 +29,7 @@ For example, if your current working directory contained
|
||||||
|
|
||||||
then the command
|
then the command
|
||||||
```
|
```
|
||||||
kexpand ./mycluster/instances | kubectl apply -f -
|
kinflate ./mycluster/instances | kubectl apply -f -
|
||||||
```
|
```
|
||||||
would modify your cluster per the resources
|
would modify your cluster per the resources
|
||||||
generated from the manifests and associated
|
generated from the manifests and associated
|
||||||
|
|
@ -20,6 +20,12 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
// TestableMain allows test coverage for main.
|
||||||
|
func TestableMain() error {
|
||||||
fmt.Println("Hello world.")
|
fmt.Println("Hello world.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
TestableMain()
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
Copyright 2017 The Kubernetes Authors.
|
||||||
|
|
||||||
|
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 (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO: real tests
|
||||||
|
// e.g. make an inmemory file system, put yaml in there, inflate it
|
||||||
|
// to a buffer, compare to expected results, etc.
|
||||||
|
// a script in there, have script write file
|
||||||
|
func TestTrueMain(t *testing.T) {
|
||||||
|
err := TestableMain()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue