Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move integration tests to integration package #2009

Merged
merged 24 commits into from
Dec 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Assert on first line
  • Loading branch information
pietern committed Dec 12, 2024
commit b1d4197c10bdc2a768e1e720d5154007c74cfa14
23 changes: 7 additions & 16 deletions integration/verify_build_tags_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
//go:build !integration

package integration

import (
"go/parser"
"go/token"
"bufio"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -37,20 +34,14 @@ func TestVerifyBuildTags(t *testing.T) {
return nil
}

fset := token.NewFileSet()
file, err := parser.ParseFile(fset, path, nil, parser.ParseComments)
f, err := os.Open(path)
require.NoError(t, err)
defer f.Close()

// Check for the "integration" build tag in the file comments.
found := false
for _, comment := range file.Comments {
if strings.Contains(comment.Text(), "+build integration") {
found = true
break
}
}

assert.True(t, found, "File %s does not specify the 'integration' build tag", path)
// Read the first line
scanner := bufio.NewScanner(f)
scanner.Scan()
assert.Equal(t, "//go:build integration", scanner.Text(), "File %s does not specify the 'integration' build tag", path)
return nil
})

Expand Down