MCPcopy Index your code
hub / github.com/docker/docker-agent / TestParseRelativeSessionRef

Function TestParseRelativeSessionRef

pkg/session/store_test.go:973–1002  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

971}
972
973func TestParseRelativeSessionRef(t *testing.T) {
974 t.Parallel()
975
976 tests := []struct {
977 name string
978 ref string
979 wantOffset int
980 wantIsRel bool
981 }{
982 {"last session", "-1", 1, true},
983 {"second to last", "-2", 2, true},
984 {"tenth session", "-10", 10, true},
985 {"regular ID", "abc123", 0, false},
986 {"UUID-like", "550e8400-e29b-41d4-a716-446655440000", 0, false},
987 {"positive number", "1", 0, false},
988 {"zero", "0", 0, false},
989 {"negative zero", "-0", 0, false},
990 {"not a number", "-abc", 0, false},
991 {"empty string", "", 0, false},
992 {"just dash", "-", 0, false},
993 }
994
995 for _, tt := range tests {
996 t.Run(tt.name, func(t *testing.T) {
997 offset, isRel := parseRelativeSessionRef(tt.ref)
998 assert.Equal(t, tt.wantOffset, offset)
999 assert.Equal(t, tt.wantIsRel, isRel)
1000 })
1001 }
1002}
1003
1004func TestResolveSessionID_SQLite(t *testing.T) {
1005 t.Parallel()

Callers

nothing calls this directly

Calls 2

parseRelativeSessionRefFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected