(t *testing.T)
| 716 | } |
| 717 | |
| 718 | func TestPartitionedDML(t *testing.T) { |
| 719 | if skipIntegrateTest { |
| 720 | t.Skip("Integration tests skipped") |
| 721 | } |
| 722 | |
| 723 | ctx, cancel := context.WithTimeout(context.Background(), 180*time.Second) |
| 724 | defer cancel() |
| 725 | |
| 726 | session, tableId, tearDown := setup(t, ctx, []string{ |
| 727 | "INSERT INTO [[TABLE]] (id, active) VALUES (1, false)", |
| 728 | }) |
| 729 | defer tearDown() |
| 730 | |
| 731 | stmt, err := BuildStatement(fmt.Sprintf("PARTITIONED UPDATE %s SET active = true WHERE true", tableId)) |
| 732 | if err != nil { |
| 733 | t.Fatalf("invalid statement: %v", err) |
| 734 | } |
| 735 | |
| 736 | if _, err := stmt.Execute(ctx, session); err != nil { |
| 737 | t.Fatalf("execution failed: %v", err) |
| 738 | } |
| 739 | |
| 740 | selectStmt := spanner.NewStatement(fmt.Sprintf("SELECT active FROM %s", tableId)) |
| 741 | var got bool |
| 742 | if err := session.client.Single().Query(ctx, selectStmt).Do(func(r *spanner.Row) error { |
| 743 | return r.Column(0, &got) |
| 744 | }); err != nil { |
| 745 | t.Fatalf("query failed: %v", err) |
| 746 | } |
| 747 | if want := true; want != got { |
| 748 | t.Errorf("PARTITIONED UPDATE was executed, but rows were not updated") |
| 749 | } |
| 750 | } |
nothing calls this directly
no test coverage detected