Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Nov 4, 2021
1 parent b02dc7b commit 4dc4f10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
12 changes: 6 additions & 6 deletions cli/log/tools/pub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ var testCliCommand = domain.CliCommand{
Version: "v1.2.3",
Command: "mantil aws install 1",
Args: []string{"pero", "zdero"},
Workspace: "my-workspace",
Project: "my-project",
Stage: "my-stage",
//Workspace.Name: "my-workspace",
//Project: "my-project",
//Stage: "my-stage",
Events: []domain.Event{
{
Deploy: &domain.Deploy{BuildDuration: 1, UploadDuration: 2, UpdateDuration: 3, UploadMiB: 4},
Deploy: &domain.Deploy{BuildDuration: 1, UploadDuration: 2, UpdateDuration: 3, UploadBytes: 4},
},
},
}

func largeTestCommnad() domain.CliCommand {
cc := testCliCommand
var events []domain.Event
for i := int64(1); i < 1000; i++ {
d := domain.Deploy{BuildDuration: i + 1, UploadDuration: i + 2, UpdateDuration: i + 3, UploadMiB: i + 4}
for i := 1; i < 1000; i++ {
d := domain.Deploy{BuildDuration: i + 1, UploadDuration: i + 2, UpdateDuration: i + 3, UploadBytes: i + 4}
events = append(events, domain.Event{Deploy: &d})
}
cc.Events = events
Expand Down
11 changes: 4 additions & 7 deletions domain/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ var testCliCommand = CliCommand{
Version: "v1.2.3",
Command: "mantil aws install",
Args: []string{"pero", "zdero"},
Workspace: "my-workspace",
Project: "my-project",
Stage: "my-stage",
Events: []Event{
{
Deploy: &Deploy{BuildDuration: 1, UploadDuration: 2, UpdateDuration: 3, UploadMiB: 4},
Deploy: &Deploy{BuildDuration: 1, UploadDuration: 2, UpdateDuration: 3, UploadBytes: 4},
},
},
}
Expand All @@ -27,13 +24,13 @@ func TestEventMarshal(t *testing.T) {
buf, err := testCliCommand.Marshal()
require.NoError(t, err)
require.True(t, gz.IsZiped(buf))
require.Len(t, buf, 150)
require.Len(t, buf, 127)

bufUnziped, err := gz.Unzip(buf)
require.NoError(t, err)
require.Len(t, bufUnziped, 164)
require.Len(t, bufUnziped, 134)

expected := `{"t":1234567890,"v":"v1.2.3","c":"mantil aws install","a":["pero","zdero"],"w":"my-workspace","p":"my-project","s":"my-stage","e":[{"d":{"b":1,"u":2,"m":4,"d":3}}]}`
expected := `{"t":1234567890,"v":"v1.2.3","c":"mantil aws install","a":["pero","zdero"],"w":{},"p":{},"s":{},"e":[{"d":{"b":1,"u":2,"m":4,"d":3}}]}`
require.Equal(t, string(bufUnziped), expected)
}

Expand Down

0 comments on commit 4dc4f10

Please sign in to comment.