Skip to content

Commit

Permalink
exclude flaky Ping test from race check
Browse files Browse the repository at this point in the history
Summary: Ping tests are flaky on GitHub, let's move them to a different test file and exclude them from racy tests

Differential Revision: D67942189
  • Loading branch information
vvfedorenko authored and facebook-github-bot committed Jan 8, 2025
1 parent 3d9cd3d commit c9598b8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
23 changes: 0 additions & 23 deletions calnex/verify/checks/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,6 @@ func TestHTTPError(t *testing.T) {
require.Equal(t, want, got)
}

func TestPing(t *testing.T) {
r := PingRemediation{}
c := Ping{Remediation: r}
require.Equal(t, "Ping", c.Name())

err := c.Run("::1", false)
require.NoError(t, err)
}

func TestPingError(t *testing.T) {
r := PingRemediation{}
c := Ping{Remediation: r}
require.Equal(t, "Ping", c.Name())

err := c.Run("1.2.3.4", false)
require.Error(t, err)

want, _ := r.Remediate()
got, err := c.Remediate()
require.NoError(t, err)
require.Equal(t, want, got)
}

func TestPSU(t *testing.T) {
r := PSURemediation{}
c := PSU{Remediation: r}
Expand Down
47 changes: 47 additions & 0 deletions calnex/verify/checks/ping_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// +build !race

Check failure on line 1 in calnex/verify/checks/ping_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofmt)
/*
Copyright (c) Facebook, Inc. and its affiliates.
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 checks

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestPing(t *testing.T) {
r := PingRemediation{}
c := Ping{Remediation: r}
require.Equal(t, "Ping", c.Name())

err := c.Run("::1", false)
require.NoError(t, err)
}

func TestPingError(t *testing.T) {
r := PingRemediation{}
c := Ping{Remediation: r}
require.Equal(t, "Ping", c.Name())

err := c.Run("1.2.3.4", false)
require.Error(t, err)

want, _ := r.Remediate()
got, err := c.Remediate()
require.NoError(t, err)
require.Equal(t, want, got)
}

0 comments on commit c9598b8

Please sign in to comment.