ninth version
Deploy / Test, build and deploy (push) Failing after 1m6s

This commit is contained in:
2026-06-08 14:25:44 +00:00
parent e8b7d8e27c
commit 20cc8506ad
21 changed files with 847 additions and 148 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ func (r Registry) SyncMetadata(ctx context.Context) error {
}
remote, err := r.gateway.GetInstrument(ctx, instrument.Ticker, instrument.ClassCode)
if err != nil {
continue
return fmt.Errorf("sync instrument metadata %s: %w", instrument.Ticker, err)
}
remote.Enabled = instrument.Enabled && remote.Enabled
remote.FundType = instrument.FundType
+38
View File
@@ -0,0 +1,38 @@
package instruments
import (
"context"
"errors"
"testing"
"github.com/shopspring/decimal"
"overnight-trading-bot/internal/domain"
"overnight-trading-bot/internal/testutil"
"overnight-trading-bot/internal/tinvest"
)
func TestSyncMetadataFailsWhenEnabledInstrumentCannotBeLoaded(t *testing.T) {
ctx := context.Background()
repo := testutil.NewMemoryRepository()
gateway := tinvest.NewFakeGateway()
instrument := domain.Instrument{
InstrumentUID: "uid",
Ticker: "TRUR",
ClassCode: "TQTF",
Lot: 1,
MinPriceIncrement: decimal.NewFromInt(1),
Currency: "RUB",
Enabled: true,
}
if err := repo.UpsertInstrument(ctx, instrument); err != nil {
t.Fatal(err)
}
gateway.Instruments["uid"] = instrument
gateway.InstrumentErrors["uid"] = errors.New("metadata unavailable")
err := NewRegistry(repo, gateway).SyncMetadata(ctx)
if err == nil {
t.Fatal("expected sync metadata error")
}
}