Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Gogo-Proto From Testsuite Definitions #3764

Merged
merged 34 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7220753
initial timestamps
d80tb7 Jun 24, 2024
efe01d0
initial timestamps
d80tb7 Jun 24, 2024
489a283
initial timestamps
d80tb7 Jun 24, 2024
b6518ed
tests
d80tb7 Jun 24, 2024
f7b83b5
merge master
d80tb7 Jun 24, 2024
2e83e1b
regen proto
d80tb7 Jun 24, 2024
13e626a
fix diff
d80tb7 Jun 24, 2024
f29fd6c
submit.go
d80tb7 Jun 24, 2024
8d49690
submit.go
d80tb7 Jun 24, 2024
eeadaa7
more fixes
d80tb7 Jun 24, 2024
cdfea38
Merge branch 'master' of github.com:armadaproject/armada into f/chris…
d80tb7 Jun 25, 2024
b6dbb80
more fixes
d80tb7 Jun 25, 2024
c35061b
lint
d80tb7 Jun 25, 2024
b0d2ae5
fix tests
d80tb7 Jun 25, 2024
0be2f4f
Merge branch 'f/chrisma/remove-gogo-1' of github.com:armadaproject/ar…
d80tb7 Jun 26, 2024
8222e55
fix proto gen
d80tb7 Jun 26, 2024
b92f6d4
fix test
d80tb7 Jun 26, 2024
c360fa0
Merge branch 'master' of github.com:armadaproject/armada into f/chris…
d80tb7 Jun 29, 2024
5e0b61c
comment out test
d80tb7 Jun 29, 2024
d8448bb
fix
d80tb7 Jun 30, 2024
65773c5
fix
d80tb7 Jun 30, 2024
63f9638
fix
d80tb7 Jul 1, 2024
0962c1c
another test
d80tb7 Jul 1, 2024
06880c8
another test
d80tb7 Jul 1, 2024
ec8cbfb
initial commit
d80tb7 Jul 1, 2024
e8d81c5
Merge branch 'master' of github.com:armadaproject/armada into f/chris…
d80tb7 Jul 2, 2024
0e42004
remove gogo from testsuite
d80tb7 Jul 2, 2024
9b0b3b2
executor
d80tb7 Jul 2, 2024
167825b
lint
d80tb7 Jul 2, 2024
26b9ca6
merge master
d80tb7 Jul 4, 2024
b4b28c3
unit test
d80tb7 Jul 4, 2024
a86eb0d
added test
d80tb7 Jul 4, 2024
3ccf658
lint
d80tb7 Jul 4, 2024
6620f65
Merge branch 'master' into f/chrisma/remove-gogo-testsuite
robertdavidsmith Jul 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/common/proto/protoutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,10 @@ func ToTimestamp(t time.Time) *types.Timestamp {
Nanos: int32(t.Nanosecond()),
}
}

d80tb7 marked this conversation as resolved.
Show resolved Hide resolved
func ToStdDuration(pd *types.Duration) time.Duration {
if pd == nil {
return 0
}
return time.Duration(pd.Seconds)*time.Second + time.Duration(pd.Nanos)*time.Nanosecond
}
34 changes: 34 additions & 0 deletions internal/common/proto/protoutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,40 @@ func TestToTimestamp(t *testing.T) {
}
}

func TestToDuration(t *testing.T) {
tests := map[string]struct {
protoDuration *types.Duration
stdDuration time.Duration
}{
"empty": {
protoDuration: &types.Duration{Seconds: 0, Nanos: 0},
stdDuration: 0 * time.Second,
},
"seconds": {
protoDuration: &types.Duration{Seconds: 100, Nanos: 0},
stdDuration: 100 * time.Second,
},
"seconds and nanos": {
protoDuration: &types.Duration{Seconds: 100, Nanos: 1000},
stdDuration: 100*time.Second + 1000*time.Nanosecond,
},
"negative": {
protoDuration: &types.Duration{Seconds: -100, Nanos: -1000},
stdDuration: -100*time.Second - 1000*time.Nanosecond,
},
"nil": {
protoDuration: nil,
stdDuration: 0 * time.Second,
},
}
types.TimestampNow()
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
assert.Equal(t, tc.stdDuration, ToStdDuration(tc.protoDuration))
})
}
}

func utcDate(year, month, day int) time.Time {
return time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)
}
3 changes: 2 additions & 1 deletion internal/testsuite/submitter/submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/pkg/errors"

"github.com/armadaproject/armada/internal/common/armadaerrors"
protoutil "github.com/armadaproject/armada/internal/common/proto"
"github.com/armadaproject/armada/pkg/api"
"github.com/armadaproject/armada/pkg/client"
)
Expand Down Expand Up @@ -46,7 +47,7 @@ func NewSubmitterFromTestSpec(conn *client.ApiConnectionDetails, testSpec *api.T
JobSetName: testSpec.JobSetId,
NumBatches: testSpec.NumBatches,
BatchSize: testSpec.BatchSize,
Interval: testSpec.Interval,
Interval: protoutil.ToStdDuration(testSpec.Interval),
RandomClientId: testSpec.RandomClientId,
out: out,
}
Expand Down
6 changes: 4 additions & 2 deletions internal/testsuite/testrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"golang.org/x/exp/maps"
"golang.org/x/sync/errgroup"

protoutil "github.com/armadaproject/armada/internal/common/proto"
"github.com/armadaproject/armada/internal/testsuite/eventbenchmark"
"github.com/armadaproject/armada/internal/testsuite/eventlogger"
"github.com/armadaproject/armada/internal/testsuite/eventsplitter"
Expand Down Expand Up @@ -67,8 +68,9 @@ func (srv *TestRunner) Run(ctx context.Context) (err error) {

// Optional timeout
var cancel context.CancelFunc
if srv.testSpec.Timeout != 0 {
ctx, cancel = context.WithTimeout(ctx, srv.testSpec.Timeout)
timeout := protoutil.ToStdDuration(srv.testSpec.Timeout)
if timeout != 0 {
ctx, cancel = context.WithTimeout(ctx, timeout)
} else {
ctx, cancel = context.WithCancel(ctx)
}
Expand Down
210 changes: 90 additions & 120 deletions pkg/api/testspec.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading