Skip to content

Potential Fix50 Market Data marshaling bug #91

@daino3

Description

@daino3
// _test.go
package main

import (
    "os"
    "testing"

    "github.com/davecgh/go-spew/spew"
    . "github.com/onsi/ginkgo"
    . "github.com/onsi/gomega"
    "github.com/quickfixgo/quickfix"
    "github.com/quickfixgo/quickfix/enum"
    "github.com/quickfixgo/quickfix/fix50/marketdatarequest"
)

func TestSubscriptionManager(t *testing.T) {
    RegisterFailHandler(Fail)
    RunSpecs(t, "Books Suite")
}

var _ = Describe("Subscription Manager", func() {
    var mdMsg marketdatarequest.Message

    BeforeEach(func() {
        one := 1
        truthy := true

        mdMsg = marketdatarequest.Message{
            FIXMsgType:              "V",
            MDReqID:                 "1-A",
            SubscriptionRequestType: "1",
            MarketDepth:             0,
            MDUpdateType:            &one,
            AggregatedBook:          &truthy,
        }
    })

    FDescribe("SubscriptionsBySessionID", func() {
        It("returns a map of session IDs to subscriptions", func() {
                // This panics in Fix50, but is fine with FIX42
                    msg := quickfix.Marshal(mdMsg)
        })
    })
})

Backtrace:

•! Panic [0.064 seconds]
Subscription Manager
/home/vagrant/go/src/github.com/connamara/longford-services/longford-fix-market-data-gateway/main_test.go:90
  SubscriptionsBySessionID
  /home/vagrant/go/src/github.com/connamara/longford-services/longford-fix-market-data-gateway/main_test.go:89
    returns a map of session IDs to subscriptions [It]
    /home/vagrant/go/src/github.com/connamara/longford-services/longford-fix-market-data-gateway/main_test.go:88

    Test Panicked
    strconv.ParseInt: parsing "": invalid syntax
    /usr/local/go/src/runtime/panic.go:426

    Full Stack Trace

        /usr/local/go/src/runtime/panic.go:426 +0x4e9
    github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix.encoder.encodeValue.func1(0x7fd70bb6e0a8, 0x8e4e80)
        /home/vagrant/go/src/github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix/marshal.go:82 +0x1f2
    github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix.encoder.encodeValue.func1(0x7fd70bb6e0a8, 0x8ab5a0)
        /home/vagrant/go/src/github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix/marshal.go:76 +0xde
    github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix.encoder.encodeValue(0xc820339650, 0x9ca650, 0x92, 0x784260, 0xc8200f0790, 0x97, 0x4deb00, 0x0)
        /home/vagrant/go/src/github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix/marshal.go:89 +0x6a1
    github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix.encoder.encodeField(0xc820339650, 0x9ca650, 0x8f7750, 0xc, 0x0, 0x0, 0x7fd70bb6e0a8, 0x784260, 0x8fd
6a0, 0x9, ...)
        /home/vagrant/go/src/github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix/marshal.go:17 +0x127
    github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix.encoder.encodeField(0xc820339650, 0x9ca650, 0x8f6c30, 0xf, 0x0, 0x0, 0x7fd70bb6e0a8, 0x84a480, 0x0,
0x0, ...)
        /home/vagrant/go/src/github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix/marshal.go:28 +0x45f
    github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix.Marshal(0x8c5600, 0xc8200f0600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/vagrant/go/src/github.com/connamara/longford-services/vendor/github.com/quickfixgo/quickfix/marshal.go:139 +0x53a
    github.com/connamara/longford-services/longford-fix-market-data-gateway.glob.func1.3.1()
        /home/vagrant/go/src/github.com/connamara/longford-services/longford-fix-market-data-gateway/main_test.go:84 +0x198
    github.com/connamara/longford-services/vendor/github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync(0xc82001a9c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/vagrant/go/src/github.com/connamara/longford-services/longford-fix-market-data-gateway/main_test.go:17 +0x7c
    testing.tRunner(0xc82008c3f0, 0xb5f890)
        /usr/local/go/src/testing/testing.go:473 +0x98
    created by testing.RunTests
        /usr/local/go/src/testing/testing.go:582 +0x892


Metadata

Metadata

Assignees

Labels

BugBehavior not matching expected

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions