Break up test suite further to avoid dead locks
This commit is contained in:
parent
b11132ea2d
commit
8b6a2f7852
1 changed files with 67 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
||||||
// table1, table2 and table3 Insert in parallel, and so forth.
|
// table1, table2 and table3 Insert in parallel, and so forth.
|
||||||
// It does NOT run each operation group in parallel.
|
// It does NOT run each operation group in parallel.
|
||||||
// Separating the tests thusly grants avoidance of Postgres deadlocks.
|
// Separating the tests thusly grants avoidance of Postgres deadlocks.
|
||||||
func TestAll(t *testing.T) {
|
func TestParent(t *testing.T) {
|
||||||
{{- range $index, $table := .Tables}}
|
{{- range $index, $table := .Tables}}
|
||||||
{{- if $table.IsJoinTable -}}
|
{{- if $table.IsJoinTable -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
|
@ -20,7 +20,25 @@ func TestDelete(t *testing.T) {
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $tableName := $table.Name | plural | titleCase -}}
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}Delete)
|
t.Run("{{$tableName}}", test{{$tableName}}Delete)
|
||||||
|
{{end -}}
|
||||||
|
{{- end -}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestQueryDeleteAll(t *testing.T) {
|
||||||
|
{{- range $index, $table := .Tables}}
|
||||||
|
{{- if $table.IsJoinTable -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}QueryDeleteAll)
|
t.Run("{{$tableName}}", test{{$tableName}}QueryDeleteAll)
|
||||||
|
{{end -}}
|
||||||
|
{{- end -}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSliceDeleteAll(t *testing.T) {
|
||||||
|
{{- range $index, $table := .Tables}}
|
||||||
|
{{- if $table.IsJoinTable -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}SliceDeleteAll)
|
t.Run("{{$tableName}}", test{{$tableName}}SliceDeleteAll)
|
||||||
{{end -}}
|
{{end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -46,14 +64,41 @@ func TestFind(t *testing.T) {
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFinishers(t *testing.T) {
|
func TestBind(t *testing.T) {
|
||||||
{{- range $index, $table := .Tables}}
|
{{- range $index, $table := .Tables}}
|
||||||
{{- if $table.IsJoinTable -}}
|
{{- if $table.IsJoinTable -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $tableName := $table.Name | plural | titleCase -}}
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}Bind)
|
t.Run("{{$tableName}}", test{{$tableName}}Bind)
|
||||||
|
{{end -}}
|
||||||
|
{{- end -}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestOne(t *testing.T) {
|
||||||
|
{{- range $index, $table := .Tables}}
|
||||||
|
{{- if $table.IsJoinTable -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}One)
|
t.Run("{{$tableName}}", test{{$tableName}}One)
|
||||||
|
{{end -}}
|
||||||
|
{{- end -}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAll(t *testing.T) {
|
||||||
|
{{- range $index, $table := .Tables}}
|
||||||
|
{{- if $table.IsJoinTable -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}All)
|
t.Run("{{$tableName}}", test{{$tableName}}All)
|
||||||
|
{{end -}}
|
||||||
|
{{- end -}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCount(t *testing.T) {
|
||||||
|
{{- range $index, $table := .Tables}}
|
||||||
|
{{- if $table.IsJoinTable -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}Count)
|
t.Run("{{$tableName}}", test{{$tableName}}Count)
|
||||||
{{end -}}
|
{{end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -91,6 +136,8 @@ func TestInsert(t *testing.T) {
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The relationship tests cannot be run in parallel
|
||||||
|
// or postgres deadlocks will occur.
|
||||||
func TestRelationships(t *testing.T) {
|
func TestRelationships(t *testing.T) {
|
||||||
{{- $dot := .}}
|
{{- $dot := .}}
|
||||||
{{- range $index, $table := .Tables}}
|
{{- range $index, $table := .Tables}}
|
||||||
|
@ -116,6 +163,15 @@ func TestReload(t *testing.T) {
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $tableName := $table.Name | plural | titleCase -}}
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}Reload)
|
t.Run("{{$tableName}}", test{{$tableName}}Reload)
|
||||||
|
{{end -}}
|
||||||
|
{{- end -}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReloadAll(t *testing.T) {
|
||||||
|
{{- range $index, $table := .Tables}}
|
||||||
|
{{- if $table.IsJoinTable -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}ReloadAll)
|
t.Run("{{$tableName}}", test{{$tableName}}ReloadAll)
|
||||||
{{end -}}
|
{{end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -137,6 +193,15 @@ func TestUpdate(t *testing.T) {
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $tableName := $table.Name | plural | titleCase -}}
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}Update)
|
t.Run("{{$tableName}}", test{{$tableName}}Update)
|
||||||
|
{{end -}}
|
||||||
|
{{- end -}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSliceUpdateAll(t *testing.T) {
|
||||||
|
{{- range $index, $table := .Tables}}
|
||||||
|
{{- if $table.IsJoinTable -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $tableName := $table.Name | plural | titleCase -}}
|
||||||
t.Run("{{$tableName}}", test{{$tableName}}SliceUpdateAll)
|
t.Run("{{$tableName}}", test{{$tableName}}SliceUpdateAll)
|
||||||
{{end -}}
|
{{end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
Loading…
Reference in a new issue