From 4a53b7295f7d1ae7f3c28437f15ca18fb925d494 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sat, 16 Dec 2023 15:29:38 -0500 Subject: [PATCH] Remove invalid concurrent tests --- progress/progress_test.go | 58 --------------------------------------- 1 file changed, 58 deletions(-) diff --git a/progress/progress_test.go b/progress/progress_test.go index d2058c24..89acbbe2 100644 --- a/progress/progress_test.go +++ b/progress/progress_test.go @@ -4,7 +4,6 @@ import ( "bytes" "io" "strings" - "sync" "testing" ) @@ -64,37 +63,6 @@ func TestCountingReader_Read(t *testing.T) { } } -func TestCountingReader_ConcurrentReads(t *testing.T) { - input := "Concurrent reading test string" - reader := strings.NewReader(input) - countingReader := NewCountingReader(reader) - - var wg sync.WaitGroup - readFunc := func() { - defer wg.Done() - buf := make([]byte, 5) // Read in chunks of 5 bytes - for { - if _, err := countingReader.Read(buf); err == io.EOF { - break - } else if err != nil { - t.Errorf("Read() error = %v", err) - } - } - } - - // Simulate concurrent reads - for i := 0; i < 3; i++ { - wg.Add(1) - go readFunc() - } - wg.Wait() - - wantCount := int64(len(input)) - if got := countingReader.Count(); got != wantCount { - t.Fatalf("CountingReader.Count() after concurrent reads = %v, want %v", got, wantCount) - } -} - func TestCountingWriter_Write(t *testing.T) { tests := []struct { name string @@ -137,29 +105,3 @@ func TestCountingWriter_Write(t *testing.T) { }) } } - -func TestCountingWriter_ConcurrentWrites(t *testing.T) { - var buf bytes.Buffer - countingWriter := NewCountingWriter(&buf) - input := "Concurrent write test string" - wantCount := int64(len(input) * 3) // 3 goroutines writing the same string - - var wg sync.WaitGroup - writeFunc := func() { - defer wg.Done() - if _, err := countingWriter.Write([]byte(input)); err != nil { - t.Errorf("Write() error = %v", err) - } - } - - // Perform concurrent writes - for i := 0; i < 3; i++ { - wg.Add(1) - go writeFunc() - } - wg.Wait() - - if got := countingWriter.Count(); got != wantCount { - t.Errorf("CountingWriter.Count() after concurrent writes = %v, want %v", got, wantCount) - } -}