testing context.TimestampOldTable

This commit is contained in:
Shlomi Noach 2017-07-19 15:22:46 +03:00
parent 168676bd9d
commit 39e73e37d0

View File

@ -7,6 +7,7 @@ package base
import (
"testing"
"time"
"github.com/outbrain/golib/log"
test "github.com/outbrain/golib/tests"
@ -35,4 +36,12 @@ func TestGetTableNames(t *testing.T) {
oldTableName := context.GetOldTableName()
test.S(t).ExpectEquals(oldTableName, "_a1234567890123456789012345678901234567890123456789012345678_del")
}
{
context.OriginalTableName = "a123456789012345678901234567890123456789012345678901234567890123"
context.TimestampOldTable = true
longForm := "Jan 2, 2006 at 3:04pm (MST)"
context.StartTime, _ = time.Parse(longForm, "Feb 3, 2013 at 7:54pm (PST)")
oldTableName := context.GetOldTableName()
test.S(t).ExpectEquals(oldTableName, "_a1234567890123456789012345678901234567890123_20130203195400_del")
}
}