Skip to content

Commit

Permalink
Add integration tests (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmiyake authored Mar 8, 2018
1 parent bd84093 commit 32e68e4
Show file tree
Hide file tree
Showing 82 changed files with 18,659 additions and 18 deletions.
30 changes: 24 additions & 6 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions integration_test/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2016 Palantir Technologies, 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 integration
88 changes: 88 additions & 0 deletions integration_test/integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2016 Palantir Technologies, 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 integration_test

import (
"testing"

"github.com/nmiyake/pkg/gofiles"
"github.com/palantir/godel/pkg/products"
"github.com/palantir/okgo/okgotester"
"github.com/stretchr/testify/require"
)

const (
okgoPluginLocator = "com.palantir.okgo:okgo-plugin:0.3.0"
okgoPluginResolver = "https://palantir.bintray.com/releases/{{GroupPath}}/{{Product}}/{{Version}}/{{Product}}-{{Version}}-{{OS}}-{{Arch}}.tgz"

godelYML = `exclude:
names:
- "\\..+"
- "vendor"
paths:
- "godel"
`
)

func TestGolint(t *testing.T) {
assetPath, err := products.Bin("golint-asset")
require.NoError(t, err)

configFiles := map[string]string{
"godel/config/godel.yml": godelYML,
"godel/config/check.yml": "",
}

okgotester.RunAssetCheckTest(t,
okgoPluginLocator, okgoPluginResolver,
assetPath, "golint",
[]okgotester.AssetTestCase{
{
Name: "lint failures",
Specs: []gofiles.GoFileSpec{
{
RelPath: "foo.go",
Src: `package foo; func Foo() int { return 0 }`,
},
},
ConfigFiles: configFiles,
WantError: true,
WantOutput: `Running golint...
foo.go:1:14: exported function Foo should have comment or be unexported
Finished golint
`,
},
{
Name: "lint failures from inner directory",
Specs: []gofiles.GoFileSpec{
{
RelPath: "foo.go",
Src: `package foo; func Foo() int { return 0 }`,
},
{
RelPath: "inner/bar",
},
},
ConfigFiles: configFiles,
Wd: "inner",
WantError: true,
WantOutput: `Running golint...
../foo.go:1:14: exported function Foo should have comment or be unexported
Finished golint
`,
},
},
)
}
22 changes: 22 additions & 0 deletions vendor/github.com/davecgh/go-spew/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/davecgh/go-spew/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/davecgh/go-spew/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 32e68e4

Please sign in to comment.