...

Source file src/edge-infra.dev/pkg/f8n/devinfra/jack/plugin/uploadjob/handler_test.go

Documentation: edge-infra.dev/pkg/f8n/devinfra/jack/plugin/uploadjob

     1  package uploadjob
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"gotest.tools/v3/assert"
     8  )
     9  
    10  func TestUnzip(t *testing.T) {
    11  	tfe := []struct {
    12  		zip     string
    13  		files   int
    14  		jobName string
    15  	}{
    16  		{
    17  			"testdata/logs-243947777.zip", 9, "build",
    18  		},
    19  		{
    20  			"testdata/logs_265.zip", 9, "build",
    21  		},
    22  		{
    23  			"testdata/logs_26436399558.zip", 14, "ci",
    24  		},
    25  		{
    26  			"testdata/logs_26436630117.zip", 15, "ci",
    27  		},
    28  	}
    29  
    30  	for i, tc := range tfe {
    31  		t.Run(fmt.Sprintf("%s_%d", t.Name(), i), func(t *testing.T) {
    32  			logs, files, err := unzip(tc.zip, tc.jobName)
    33  			assert.NilError(t, err, "Failed to unzip the go created zip file")
    34  			assert.Assert(t, len(logs) > 0, "Failed to get the file contents")
    35  			assert.Assert(t, len(files) == tc.files, "Failed to get the file count")
    36  		})
    37  	}
    38  }
    39  

View as plain text