diff --git a/go.mod b/go.mod index e1cd405..f11000f 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 05dc6a3..355364a 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/internal/qa/event.go b/internal/qa/event.go index 8ccd16e..4ba5284 100644 --- a/internal/qa/event.go +++ b/internal/qa/event.go @@ -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 // @@ -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) @@ -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) @@ -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) @@ -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") } @@ -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") }