mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Avoid data races in unit tests
This commit is contained in:
parent
8f7eb4e6ac
commit
b562263427
@ -18,7 +18,6 @@ package state
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -69,9 +68,6 @@ func stderrCapture(t *testing.T, f func() State) (bytes.Buffer, State) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFileStateTryRestore(t *testing.T) {
|
func TestFileStateTryRestore(t *testing.T) {
|
||||||
flag.Set("alsologtostderr", "true")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
description string
|
description string
|
||||||
stateFileContent string
|
stateFileContent string
|
||||||
@ -292,9 +288,6 @@ func TestFileStateTryRestorePanic(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateStateFile(t *testing.T) {
|
func TestUpdateStateFile(t *testing.T) {
|
||||||
flag.Set("alsologtostderr", "true")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
description string
|
description string
|
||||||
expErr string
|
expErr string
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package devicemanager
|
package devicemanager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -546,7 +545,6 @@ type TestResource struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPodContainerDeviceAllocation(t *testing.T) {
|
func TestPodContainerDeviceAllocation(t *testing.T) {
|
||||||
flag.Set("alsologtostderr", fmt.Sprintf("%t", true))
|
|
||||||
res1 := TestResource{
|
res1 := TestResource{
|
||||||
resourceName: "domain1.com/resource1",
|
resourceName: "domain1.com/resource1",
|
||||||
resourceQuantity: *resource.NewQuantity(int64(2), resource.DecimalSI),
|
resourceQuantity: *resource.NewQuantity(int64(2), resource.DecimalSI),
|
||||||
|
Loading…
Reference in New Issue
Block a user