Skip to content

Commit

Permalink
Sync build tags in *_test.go (#2767)
Browse files Browse the repository at this point in the history
Ensure that unwanted tests are correctly excluded when various build
tags are specified, i.e. when the code that they test would be excluded
from compilation.

Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
  • Loading branch information
dswarbrick authored Aug 15, 2023
1 parent 3fb5f70 commit 37ce0ba
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 4 deletions.
3 changes: 3 additions & 0 deletions collector/bonding_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nobonding
// +build !nobonding

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/diskstats_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nodiskstats
// +build !nodiskstats

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/ethtool_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !noethtool
// +build !noethtool

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/filefd_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nofilefd
// +build !nofilefd

package collector

import "testing"
Expand Down
5 changes: 4 additions & 1 deletion collector/filesystem_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nofilesystem
// +build !nofilesystem

package collector

import (
"github.com/go-kit/log"
"strings"
"testing"

"github.com/alecthomas/kingpin/v2"
"github.com/go-kit/log"
)

func Test_parseFilesystemLabelsError(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions collector/interrupts_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nointerrupts
// +build !nointerrupts

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/ipvs_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !noipvs
// +build !noipvs

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/loadavg_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !noloadavg
// +build !noloadavg

package collector

import "testing"
Expand Down
3 changes: 3 additions & 0 deletions collector/logind_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nologind
// +build !nologind

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/meminfo_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nomeminfo
// +build !nomeminfo

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/meminfo_numa_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nomeminfo_numa
// +build !nomeminfo_numa

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/netdev_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nonetdev
// +build !nonetdev

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/netstat_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nonetstat
// +build !nonetstat

package collector

import (
Expand Down
5 changes: 2 additions & 3 deletions collector/perf_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !noprocesses
// +build !noprocesses
//go:build !noperf
// +build !noperf

package collector

Expand All @@ -24,7 +24,6 @@ import (
"testing"

"github.com/go-kit/log"

"github.com/prometheus/client_golang/prometheus"
)

Expand Down
3 changes: 3 additions & 0 deletions collector/systemd_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !nosystemd
// +build !nosystemd

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/tcpstat_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !notcpstat
// +build !notcpstat

package collector

import (
Expand Down
3 changes: 3 additions & 0 deletions collector/textfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !notextfile
// +build !notextfile

package collector

import (
Expand Down

0 comments on commit 37ce0ba

Please sign in to comment.