package uploadjob import ( "fmt" "testing" "gotest.tools/v3/assert" ) func TestUnzip(t *testing.T) { tfe := []struct { zip string files int jobName string }{ { "testdata/logs-243947777.zip", 9, "build", }, { "testdata/logs_265.zip", 9, "build", }, { "testdata/logs_26436399558.zip", 14, "ci", }, { "testdata/logs_26436630117.zip", 15, "ci", }, } for i, tc := range tfe { t.Run(fmt.Sprintf("%s_%d", t.Name(), i), func(t *testing.T) { logs, files, err := unzip(tc.zip, tc.jobName) assert.NilError(t, err, "Failed to unzip the go created zip file") assert.Assert(t, len(logs) > 0, "Failed to get the file contents") assert.Assert(t, len(files) == tc.files, "Failed to get the file count") }) } }