Skip to content

Commit

Permalink
Merge pull request #4 from michaeldiamant/revert_approvals_test
Browse files Browse the repository at this point in the history
Revert "Prototype approval test for GetRoundStateDelta"
  • Loading branch information
Eric-Warehime authored Nov 28, 2022
2 parents 6b669a3 + ba7c1ce commit 15372b4
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 93 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,3 @@ index.html

# test summary
testresults.json

# Received approval test files
*.received.*
42 changes: 0 additions & 42 deletions daemon/algod/api/server/v2/test/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"encoding/json"
"errors"
"fmt"
approvals "github.com/approvals/go-approval-tests"
"github.com/approvals/go-approval-tests/reporters"
"io"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -157,46 +155,6 @@ func TestGetRoundStateDelta(t *testing.T) {
require.Equal(t, poolDeltaResponseGolden.Totals, actualResponse.Totals)
}

type AssertableHTTPResponse struct {
Status string `json:"status"`
StatusCode int `json:"statusCode"`
Headers http.Header `json:"headers"`
Body interface{} `json:"body"`
}

func TestGetRoundStateDeltaApproval(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)

handler, c, rec, _, _, releasefunc := setupTestForMethodGet(t)
defer releasefunc()
insertRounds(a, handler, 3)

err := handler.GetRoundStateDelta(c, 2)
require.NoError(t, err)

actualResponse := model.RoundStateDelta{}
err = protocol.DecodeJSON(rec.Body.Bytes(), &actualResponse)

// Blot out non-deterministic PrevTimestamp
require.NotZero(t, actualResponse.PrevTimestamp)
z := uint64(0)
actualResponse.PrevTimestamp = &z

res := rec.Result()
resp := AssertableHTTPResponse{
res.Status,
res.StatusCode,
res.Header,
actualResponse,
}

approvals.UseFolder("testdata")
approvals.UseReporter(reporters.NewRealDiffReporter())
approvals.VerifyJSONBytes(t, protocol.EncodeJSON(resp))
}

func TestSyncRound(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/algorand/msgp v1.1.53
github.com/algorand/oapi-codegen v1.12.0-algorand.0
github.com/algorand/websocket v1.4.5
github.com/approvals/go-approval-tests v0.0.0-20220530063708-32d5677069bd
github.com/aws/aws-sdk-go v1.16.5
github.com/consensys/gnark-crypto v0.7.0
github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ github.com/algorand/websocket v1.4.5 h1:Cs6UTaCReAl02evYxmN8k57cNHmBILRcspfSxYg4
github.com/algorand/websocket v1.4.5/go.mod h1:79n6FSZY08yQagHzE/YWZqTPBYfY5wc3IS+UTZe1W5c=
github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ=
github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk=
github.com/approvals/go-approval-tests v0.0.0-20220530063708-32d5677069bd h1:8j7sBEy0h6+Bvr0AeKHIHCsmzCzWGXAQweA7k+uiRYk=
github.com/approvals/go-approval-tests v0.0.0-20220530063708-32d5677069bd/go.mod h1:PJOqSY8IofNv3heAD6k8E7EfFS6okiSS9bSAasaAUME=
github.com/aws/aws-sdk-go v1.16.5 h1:NVxzZXIuwX828VcJrpNxxWjur1tlOBISdMdDdHIKHcc=
github.com/aws/aws-sdk-go v1.16.5/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
Expand Down

0 comments on commit 15372b4

Please sign in to comment.