Skip to content

Commit

Permalink
BQ: Fix substitutions schema (#66)
Browse files Browse the repository at this point in the history
Fixed bug introduced by #65 .

* fix substitution struct bug

* add inferschema test

* address pr comments
  • Loading branch information
Aric1088 authored Aug 11, 2020
1 parent 7c39f4f commit 95eaa62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bigquery/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ type bqRow struct {
Tags []string
Env []string
LogURL string
Substitutions [][]string
Substitutions []*substitution
}

type substitution struct {
Key string
Value string
}

type buildImage struct {
Expand Down Expand Up @@ -255,9 +260,9 @@ func (n *bqNotifier) SendNotification(ctx context.Context, build *cbpb.Build) er
if err != nil {
return fmt.Errorf("Error generating UTM params: %v", err)
}
substitutions := [][]string{}
substitutions := []*substitution{}
for key, value := range build.Substitutions {
substitutions = append(substitutions, []string{key, value})
substitutions = append(substitutions, &substitution{key, value})
}
newRow := &bqRow{
ProjectID: build.ProjectId,
Expand Down
6 changes: 6 additions & 0 deletions bigquery/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,9 @@ func TestGetImageSize(t *testing.T) {
})
}
}

func TestInferSchema(t *testing.T) {
if _, err := bigquery.InferSchema(bqRow{}); err != nil {
t.Errorf("Failed to infer schema: %v", err)
}
}

0 comments on commit 95eaa62

Please sign in to comment.