diff --git a/acceptance/topo_cs_reload/reload_test.go b/acceptance/topo_cs_reload/reload_test.go index 55e30c924d..790f4a0120 100644 --- a/acceptance/topo_cs_reload/reload_test.go +++ b/acceptance/topo_cs_reload/reload_test.go @@ -22,6 +22,7 @@ import ( "net/http" "os" "os/exec" + "strings" "testing" "time" @@ -42,6 +43,10 @@ var ( ) func TestPSTopoReload(t *testing.T) { + if !strings.HasSuffix(os.Getenv("TEST_TARGET"), "go_default_test") { + t.Skip("This test only runs as bazel unit test") + } + // BUG(matzf): teardown is not called when setup fails. Rewrite with T.Cleanup and T.Tempdir s := setupTest(t) defer s.teardownTest(t) diff --git a/acceptance/topo_daemon_reload/reload_test.go b/acceptance/topo_daemon_reload/reload_test.go index 7a39ce2320..243cb133aa 100644 --- a/acceptance/topo_daemon_reload/reload_test.go +++ b/acceptance/topo_daemon_reload/reload_test.go @@ -21,6 +21,7 @@ import ( "net/http" "os" "os/exec" + "strings" "testing" "time" @@ -31,6 +32,10 @@ import ( ) func TestSDTopoReload(t *testing.T) { + if !strings.HasSuffix(os.Getenv("TEST_TARGET"), "go_default_test") { + t.Skip("This test only runs as bazel unit test") + } + defer teardownTest(t) setupTest(t) diff --git a/tools/lint/logctxcheck/testdata/src/fake/lib/slog/slog.go b/tools/lint/logctxcheck/testdata/src/fake/lib/slog/slog.go new file mode 100644 index 0000000000..42bf45c33d --- /dev/null +++ b/tools/lint/logctxcheck/testdata/src/fake/lib/slog/slog.go @@ -0,0 +1,20 @@ +// Copyright 2023 Anapaya Systems +// +// 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 slog is a stub for testing +package slog + +func Debug(string, ...any) {} +func Info(string, ...any) {} +func Error(string, ...any) {} diff --git a/tools/lint/logctxcheck/testdata/src/github.com/scionproto/scion/pkg/log b/tools/lint/logctxcheck/testdata/src/github.com/scionproto/scion/pkg/log deleted file mode 120000 index e86440b89c..0000000000 --- a/tools/lint/logctxcheck/testdata/src/github.com/scionproto/scion/pkg/log +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../pkg/log \ No newline at end of file diff --git a/tools/lint/logctxcheck/testdata/src/github.com/scionproto/scion/pkg/log/log.go b/tools/lint/logctxcheck/testdata/src/github.com/scionproto/scion/pkg/log/log.go new file mode 100644 index 0000000000..14c664ba96 --- /dev/null +++ b/tools/lint/logctxcheck/testdata/src/github.com/scionproto/scion/pkg/log/log.go @@ -0,0 +1,32 @@ +// Copyright 2023 Anapaya Systems +// +// 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 log is a stub for the actual log package. It allows the logctxcheck +// analyzer tests to run. +package log + +import "context" + +func Debug(string, ...any) {} +func Info(string, ...any) {} +func Error(string, ...any) {} +func New(...any) Logger { return nil } +func FromCtx(context.Context) Logger { return nil } +func Root() Logger { return nil } + +type Logger interface { + Debug(string, ...any) + Info(string, ...any) + Error(string, ...any) +} diff --git a/tools/lint/serrorscheck/testdata/src/fake/serrors/serrors.go b/tools/lint/serrorscheck/testdata/src/fake/serrors/serrors.go new file mode 100644 index 0000000000..4e1a69166c --- /dev/null +++ b/tools/lint/serrorscheck/testdata/src/fake/serrors/serrors.go @@ -0,0 +1,19 @@ +// Copyright 2023 Anapaya Systems +// +// 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 serrors is a stub for testing +package serrors + +func New(string, ...any) error { return nil } +func Wrap(error, error, ...any) error { return nil } diff --git a/tools/lint/serrorscheck/testdata/src/github.com/scionproto/scion/pkg/private/serrors/serrors.go b/tools/lint/serrorscheck/testdata/src/github.com/scionproto/scion/pkg/private/serrors/serrors.go new file mode 100644 index 0000000000..95b5ffb8ac --- /dev/null +++ b/tools/lint/serrorscheck/testdata/src/github.com/scionproto/scion/pkg/private/serrors/serrors.go @@ -0,0 +1,22 @@ +// Copyright 2023 Anapaya Systems +// +// 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 serrors is a stub for the actual serrors package. It allows the +// serrorscheck analyzer tests to run. +package serrors + +func New(string, ...any) error { return nil } +func Wrap(error, error, ...any) error { return nil } +func WrapStr(error, string, ...any) error { return nil } +func WithCtx(error, ...any) error { return nil }