]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/gob: delete out of memory test
authorRob Pike <r@golang.org>
Mon, 22 Oct 2018 20:01:35 +0000 (07:01 +1100)
committerRob Pike <r@golang.org>
Mon, 22 Oct 2018 22:23:03 +0000 (22:23 +0000)
Now that the library allows much larger data, it can kill
machines with less memory.

Fixes #28321

Change-Id: I98e1a5fdf812fd75adfb22bf01542423de405fe2
Reviewed-on: https://go-review.googlesource.com/c/143817
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/encoding/gob/encoder_test.go

index dc9bbcf35d8b5a9553f38e305773961d1f3ab35c..825f0d6f03eff0d2a74a79465b7307f0d33a75ba 100644 (file)
@@ -10,7 +10,6 @@ import (
        "fmt"
        "io/ioutil"
        "reflect"
-       "runtime"
        "strings"
        "testing"
 )
@@ -1128,24 +1127,3 @@ func TestBadData(t *testing.T) {
                }
        }
 }
-
-// TestHugeWriteFails tests that enormous messages trigger an error.
-func TestHugeWriteFails(t *testing.T) {
-       if runtime.GOARCH == "wasm" {
-               t.Skip("out of memory on wasm")
-       }
-       if testing.Short() {
-               // Requires allocating a monster, so don't do this from all.bash.
-               t.Skip("skipping huge allocation in short mode")
-       }
-       huge := make([]byte, tooBig)
-       huge[0] = 7 // Make sure it's not all zeros.
-       buf := new(bytes.Buffer)
-       err := NewEncoder(buf).Encode(huge)
-       if err == nil {
-               t.Fatalf("expected error for huge slice")
-       }
-       if !strings.Contains(err.Error(), "message too big") {
-               t.Fatalf("expected 'too big' error; got %s\n", err.Error())
-       }
-}