(t *testing.T)
| 127 | } |
| 128 | |
| 129 | func TestLive_Introspect(t *testing.T) { |
| 130 | s := liveSession(t) |
| 131 | defer s.Close() |
| 132 | setupLiveSchema(t, s) |
| 133 | |
| 134 | conn := &Conn{session: s, keyspace: "gjtest"} |
| 135 | ctx := context.Background() |
| 136 | |
| 137 | colRows, err := conn.introspect(ctx, &QueryDSL{Operation: OpIntrospectColumns}) |
| 138 | if err != nil { |
| 139 | t.Fatalf("introspect columns: %v", err) |
| 140 | } |
| 141 | seen := map[string]bool{} |
| 142 | for _, r := range drain(t, colRows) { |
| 143 | seen[r[1].(string)+"."+r[2].(string)] = true |
| 144 | } |
| 145 | for _, want := range []string{"users.id", "users.name", "posts.user_id", "posts.id", "posts.title"} { |
| 146 | if !seen[want] { |
| 147 | t.Fatalf("introspect columns missing %s; got %#v", want, seen) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | keyRows, err := conn.introspect(ctx, &QueryDSL{Operation: OpIntrospectKeys}) |
| 152 | if err != nil { |
| 153 | t.Fatalf("introspect keys: %v", err) |
| 154 | } |
| 155 | roles := map[string]string{} |
| 156 | for _, r := range drain(t, keyRows) { |
| 157 | roles[r[0].(string)+"."+r[1].(string)] = r[2].(string) |
| 158 | } |
| 159 | if roles["posts.user_id"] != "partition_key" || roles["posts.id"] != "clustering" || roles["users.id"] != "partition_key" { |
| 160 | t.Fatalf("introspect key roles wrong: %#v", roles) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // TestLive_Paging exercises the gocql PageState/PageSize round-trip the cursor |
| 165 | // codec maps to GraphJin cursors. |
nothing calls this directly
no test coverage detected