fix: table 'overnight_bot.system_state_history' doesn't exist
Deploy / Test, build and deploy (push) Successful in 1m49s

This commit is contained in:
2026-06-08 15:47:00 +00:00
parent bbf55a064e
commit 82cd1936ea
2 changed files with 24 additions and 1 deletions
+15
View File
@@ -1,9 +1,12 @@
package mysql
import (
"errors"
"fmt"
"testing"
"time"
mysql "github.com/go-sql-driver/mysql"
"github.com/shopspring/decimal"
"overnight-trading-bot/internal/domain"
@@ -25,3 +28,15 @@ func TestMinuteCandleRowPreservesTimestamp(t *testing.T) {
t.Fatalf("daily timestamp was not truncated to date: %s", daily.TradeDate)
}
}
func TestIsMissingTableError(t *testing.T) {
if !isMissingTableError(&mysql.MySQLError{Number: 1146}) {
t.Fatal("expected MySQL 1146 to be treated as missing table")
}
if !isMissingTableError(fmt.Errorf("wrap: %w", &mysql.MySQLError{Number: 1146})) {
t.Fatal("expected wrapped MySQL 1146 to be treated as missing table")
}
if isMissingTableError(errors.New("not mysql")) {
t.Fatal("plain errors must not be treated as missing table")
}
}