Skip to content

Commit

Permalink
feat(qa): process the errClass field
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Nov 29, 2024
1 parent 81d3408 commit 7d78628
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/miekg/dns v1.1.62
github.com/rbmk-project/common v0.4.0
github.com/rbmk-project/dnscore v0.6.0
github.com/rbmk-project/x v0.0.0-20241129091418-83d898f771ef
github.com/rbmk-project/x v0.0.0-20241129115026-1ae0b6afd0db
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/rbmk-project/common v0.4.0 h1:gw7f/YdPxcUZ81cO9IMzEPDhsc6tOUte1m0OFi6
github.com/rbmk-project/common v0.4.0/go.mod h1:uzrFIJl8SEOpgS2pSeBFLUgqc4D1lIcGk/EYuxkFO0U=
github.com/rbmk-project/dnscore v0.6.0 h1:23rRsLBwTkQqJQMVPf4kimzGSZsw29EY7u3ffHbWkKg=
github.com/rbmk-project/dnscore v0.6.0/go.mod h1:Ct9RhR8HTI6tnq6/HSbzB/F8bk3k7E/6hmEctxSecUQ=
github.com/rbmk-project/x v0.0.0-20241129091418-83d898f771ef h1:4+h9APkbuAP1d1PMQ4K279Rpe+J5XRHKf+3z85RHE9o=
github.com/rbmk-project/x v0.0.0-20241129091418-83d898f771ef/go.mod h1:1Du1EHDkRs9D7MmpLPKAuBzZuJXRbvpBbefW0bTBVbs=
github.com/rbmk-project/x v0.0.0-20241129115026-1ae0b6afd0db h1:5w5kA2sSKIM0fQiALZG5TbP2C0Y6PKQFWSDxkm3QHfw=
github.com/rbmk-project/x v0.0.0-20241129115026-1ae0b6afd0db/go.mod h1:1Du1EHDkRs9D7MmpLPKAuBzZuJXRbvpBbefW0bTBVbs=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand Down
15 changes: 15 additions & 0 deletions internal/qa/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ type Event struct {
// Err is the Go error that occurred.
Err string `json:"err,omitempty"`

// ErrClass is the error classification to a fixed set
// or enumerated strings or "" on success.
ErrClass string `json:"errClass,omitempty"`

//
// I/O operations
//
Expand Down Expand Up @@ -159,6 +163,7 @@ func (ev *Event) VerifyReadWriteClose(t Driver) {
ev.verifyEndpoint(t, ev.LocalAddr)
ev.verifyEndpoint(t, ev.RemoteAddr)
ev.verifyErrEmpty(t)
ev.verifyErrClassEmpty(t)
ev.verifyIOBufferSizePositive(t)
ev.verifyIOBytesCountZero(t)

Expand All @@ -168,6 +173,7 @@ func (ev *Event) VerifyReadWriteClose(t Driver) {
ev.verifyEndpoint(t, ev.LocalAddr)
ev.verifyEndpoint(t, ev.RemoteAddr)
ev.verifyErrEmpty(t)
ev.verifyErrClassEmpty(t)
ev.verifyIOBufferSizeZero(t)
ev.verifyIOBytesCountZero(t)

Expand All @@ -178,6 +184,7 @@ func (ev *Event) VerifyReadWriteClose(t Driver) {
ev.verifyEndpoint(t, ev.RemoteAddr)
ev.verifyIOBufferSizeZero(t)
ev.verifyIOBytesCountOrErr(t)
ev.verifyIOBytesCountOrErrClass(t)

case "closeDone":
ev.verifyDoneEventTime(t)
Expand Down Expand Up @@ -236,6 +243,10 @@ func (ev *Event) verifyErrEmpty(t Driver) {
require.Empty(t, ev.Err, "expected empty error field")
}

func (ev *Event) verifyErrClassEmpty(t Driver) {
require.Empty(t, ev.ErrClass, "expected empty errClass field")
}

func (ev *Event) verifyIOBufferSizePositive(t Driver) {
require.True(t, ev.IOBufferSize > 0, "expected positive ioBufferSize field")
}
Expand All @@ -252,6 +263,10 @@ func (ev *Event) verifyIOBytesCountOrErr(t Driver) {
require.True(t, ev.IOBytesCount > 0 || ev.Err != "", "expected ioBytesCount > 0 or err != \"\"")
}

func (ev *Event) verifyIOBytesCountOrErrClass(t Driver) {
require.True(t, ev.IOBytesCount > 0 || ev.ErrClass != "", "expected ioBytesCount > 0 or errClass != \"\"")
}

func (ev *Event) verifyDNSRawQueryEmpty(t Driver) {
require.Empty(t, ev.DNSRawQuery, "expected empty dnsRawQuery field")
}
Expand Down

0 comments on commit 7d78628

Please sign in to comment.