Repository navigation
daytrader-go: tests - #7
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the 24 JUnit 5 tests in
daytrader3-ee6-ejb/src/testto Go and adds tests for the scaffold packages. Only new*_test.gofiles; no scaffold file,go.mod, Makefile, docs, parity or CI change.Database tests skip with
t.SkipwhenTEST_DATABASE_URLis unset. When it is set, each package works in its own schema (daytrader_test_store,daytrader_test_seed,daytrader_test_web, viasearch_path), so packages run in parallel and a database seeded bymake go-run(schemapublic) is not touched.Gate, as observed locally (Go 1.27.0)
gofmt -l .go vet ./...go test ./...(no database)go test -race ./...withTEST_DATABASE_URLagainstmake go-db-count=3Parity: this workstream has no target scenarios and
make paritywas not run, against Liberty or against the Go target, alone or combined with sibling branches. No scenario is claimed as PASS.Legacy test -> Go test
FinancialUtilsTest.computeGainSubtractsOpenFromCurrentAtScaleTwojavafmt.TestComputeGainSubtractsOpenFromCurrentAtScaleTwoFinancialUtilsTest.computeGainRejectsValuesThatNeedRoundingjavafmt.ComputeGainreturns a decimal and cannot throw.TestComputeGainKeepsExtraDecimalsInsteadOfThrowingpins what Go does (1.005, printed1.01)FinancialUtilsTest.computeGainPercentIsRelativeToOpenBalancejavafmt.TestComputeGainPercentIsRelativeToOpenBalance(plus half-up cases)FinancialUtilsTest.computeGainPercentIsZeroWhenOpenBalanceIsZerojavafmt.TestComputeGainPercentIsZeroWhenOpenBalanceIsZeroFinancialUtilsTest.computeHoldingsTotalSumsPurchasePriceTimesQuantityjavafmt.TestHoldingsTotalSumsPurchasePriceTimesQuantityFinancialUtilsTest.computeHoldingsTotalHandlesNullAndEmptyjavafmt.TestHoldingsTotalHandlesNilAndEmptyFinancialUtilsTest.printGainHtmlUsesRedDownArrowForLossesAndGreenUpArrowOtherwisejavafmt.TestPrintGainHTMLUsesRedDownArrowForLossesAndGreenUpArrowOtherwise(whole string)FinancialUtilsTest.printGainPercentHtmlPrefixesPositiveValuesWithPlusjavafmt.TestPrintGainPercentHTMLPrefixesPositiveValuesWithPlusFinancialUtilsTest.printChangeHtmlRendersRawDoublejavafmt.TestPrintChangeHTMLRendersRawDoubleFinancialUtilsTest.printQuoteLinkPointsAtQuotesActionjavafmt.TestPrintQuoteLinkPointsAtQuotesActionTradeConfigTest.defaultsMatchTheShippedConfigurationconfig.TestFromEnvDefaultsMatchTheShippedConfiguration.runTimeMode(EJB3) has no Go equivalent;DATASOURCEbecameDATABASE_URLTradeConfigTest.runTimeModeIsMatchedByDisplayNameIgnoringCaseAndWhitespacesetConfigParam. Case-insensitive matching of the one remaining enum:config.TestOrderProcessingModeIsMatchedIgnoringCaseTradeConfigTest.unknownEnumValueLeavesSettingUnchangedconfig.TestOrderProcessingModeIsMatchedIgnoringCase+config.TestUnknownOrderProcessingModeIsAnError(Go refuses to start instead of keeping the old value)TradeConfigTest.nullOrBlankParametersAreIgnoredconfig.TestFromEnvEmptyValuesFallBackToDefaults(an empty variable keeps the default; there are no null parameter names)TradeConfigTest.webInterfaceWorkloadMixAndCachingTypeAreParsedwebInterface,workloadMixandcachingTypedo not exist inconfig.ConfigTradeConfigTest.numericLimitsAreParsedAndBadNumbersAreIgnoredconfig.TestNumericLimitsAreParsedAndBadNumbersAreErrors(a bad number is a start-up error) andconfig.TestNumericValuesAreTrimmedLikeSetConfigParam(skipped, see below)TradeConfigTest.orderFeeAppliesToBuyAndSellOnlyconfig.TestOrderFeeAppliesToBuyAndSellOnlyTradeConfigTest.nextUserIdWrapsAtMaxUsersTradeConfig.nextUserID(load-generator helper) is not in the scaffoldTradeConfigTest.randomSymbolsStayInsideTheQuotePopulationrndSymbolfunction; the same bound (s:0..s:MAX_QUOTES-2) is asserted on every seeded holding inseed.TestBuildDBPopulatesUsersQuotesHoldingsAndOrders(database)TradeConfigTest.priceChangeFactorStaysWithinTwentyPercentseed.TestPriceChangeFactorStaysWithinTwentyPercentEntityMappingTest.entitiesMapToTheDerbyTablesWithNonNullIdsdaytradergo.TestSchemaKeepsTheLegacyTablesWithNonNullIDs(embedded migration, no database) andseed.TestBuildTablesCreatesTheLegacyTablesWithNonNullIDs(information_schema, database)EntityMappingTest.equalityIsByIdentifierOnlystorestructs have noequals/hashCodeEntityMappingTest.orderTypeAndStatusPredicatesstore.Orderhas noisBuy/isSell/isOpen/isCompleted; feature areas compareOrderType/OrderStatusstringsEntityMappingTest.cancelMarksOrderCancelledAndCompletedstore.Orderhas nocancel()New scaffold tests
internal/config: defaults, every override,nillookup reads the process environment, first bad value is reported, bad flags.internal/javafmt:Date(java.util.Date.toString in UTC),Double,Money, link escaping.internal/web(httptest, no database; the pool points at a closed port and never connects): front controller (no action, not logged in, unknown action, public action, POST form, 405), session cookie, login then protected action,Invalidate, 30 minute idle timeout, registry (duplicate panics, sorted list,RegisterWelcome,RegisterErrorPage),Forward/Attr/Param,Render, panic -> 500, routes under the context path and REST root, static files,/redirect, health DOWN,/config, layout and closed-orders alert HTML, template functions. With a database: health UP,/config?action=buildDBTables|buildDB, the closed-orders alert shown once.internal/store(database):NextID(starts at 0, block reservation inkeygenejb, key names independent, second store /ResetKeysstart at the next block, existing key row, unique under concurrency, default block size),ClosedOrders(closed only, ordered, returned as completed, once, per user), single-row reads andErrNotFound, list ordering,InTxcommit and rollback.internal/seed(database,MAX_USERS=25,MAX_QUOTES=12):BuildTables(tables, ids, drops data and key blocks, recovers a partly dropped schema),BuildDB(counts, profiles,uid:0opens with 1,000,000, balance = open balance - sum(quantity x price + 24.95), order/holding links, quote volume = shares bought,keygenejbblocks and the nextNextID, same random seed -> same data,UPDATE_QUOTE_PRICES=false,MAX_QUOTES=1).Scaffold findings (not fixed here; scaffold files are not mine to edit)
Each is a skipped assertion with the reason in the
t.Skipmessage, so the gate stays green:config.FromEnvdoes not trim whitespace:MAX_USERS=" 200 "is an error, legacysetConfigParamreads it as 200.TestNumericValuesAreTrimmedLikeSetConfigParam.javafmt.Doubleprints10000000.0for 1e7 and0.0001for 1e-4; JavaDouble.toStringprints1.0E7and1.0E-4. The function's comment limits it to "the magnitudes DayTrader shows"; a quote volume of 10,000,000 or more would differ from legacy.TestDoubleUsesScientificNotationOutsideTheJavaPlainRange.store.Scan*fail on NULL in the nullable legacy columns (cannot scan NULL into *string), where JPA gives a null field. The seeder never writes NULL there.TestRowsWithNullColumnsCanBeRead.Different from legacy on purpose (scaffold decisions the tests pin)
ORDER_PROCESSING_MODEis a start-up error, not silently ignored.ComputeGaindoes not throw for a third decimal place.PrintQuoteLinkHTML-escapes the symbol.Scaffold requests
.github/workflows/ci.ymlhas nogo vet/go teststep and no PostgreSQL service withTEST_DATABASE_URL, so the database tests only run locally.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/0b73d91748634cd6addb1a7994bdb332
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/0b73d91748634cd6addb1a7994bdb332?variant=devin
Requested by: @sumitshatwara