1515package server
1616
1717import (
18- "io/ioutil"
1918 "os"
2019 "strings"
2120 "testing"
@@ -47,67 +46,67 @@ func TestLoadFile_LargeDoc(t *testing.T) {
4746}
4847
4948func TestDecompressPipelineTarball (t * testing.T ) {
50- tarballByte , _ := ioutil .ReadFile ("test/arguments_tarball/arguments.tar.gz" )
49+ tarballByte , _ := os .ReadFile ("test/arguments_tarball/arguments.tar.gz" )
5150 pipelineFile , err := DecompressPipelineTarball (tarballByte )
5251 assert .Nil (t , err )
5352
54- expectedPipelineFile , _ := ioutil .ReadFile ("test/arguments-parameters.yaml" )
53+ expectedPipelineFile , _ := os .ReadFile ("test/arguments-parameters.yaml" )
5554 assert .Equal (t , expectedPipelineFile , pipelineFile )
5655}
5756
5857func TestDecompressPipelineTarball_MalformattedTarball (t * testing.T ) {
59- tarballByte , _ := ioutil .ReadFile ("test/malformatted_tarball.tar.gz" )
58+ tarballByte , _ := os .ReadFile ("test/malformatted_tarball.tar.gz" )
6059 _ , err := DecompressPipelineTarball (tarballByte )
6160 assert .NotNil (t , err )
6261 assert .Contains (t , err .Error (), "Not a valid tarball file" )
6362}
6463
6564func TestDecompressPipelineTarball_NonYamlTarball (t * testing.T ) {
66- tarballByte , _ := ioutil .ReadFile ("test/non_yaml_tarball/non_yaml_tarball.tar.gz" )
65+ tarballByte , _ := os .ReadFile ("test/non_yaml_tarball/non_yaml_tarball.tar.gz" )
6766 _ , err := DecompressPipelineTarball (tarballByte )
6867 assert .NotNil (t , err )
6968 assert .Contains (t , err .Error (), "Expecting a pipeline.yaml file inside the tarball" )
7069}
7170
7271func TestDecompressPipelineTarball_EmptyTarball (t * testing.T ) {
73- tarballByte , _ := ioutil .ReadFile ("test/empty_tarball/empty.tar.gz" )
72+ tarballByte , _ := os .ReadFile ("test/empty_tarball/empty.tar.gz" )
7473 _ , err := DecompressPipelineTarball (tarballByte )
7574 assert .NotNil (t , err )
7675 assert .Contains (t , err .Error (), "Not a valid tarball file" )
7776}
7877
7978func TestDecompressPipelineZip (t * testing.T ) {
80- zipByte , _ := ioutil .ReadFile ("test/arguments_zip/arguments-parameters.zip" )
79+ zipByte , _ := os .ReadFile ("test/arguments_zip/arguments-parameters.zip" )
8180 pipelineFile , err := DecompressPipelineZip (zipByte )
8281 assert .Nil (t , err )
8382
84- expectedPipelineFile , _ := ioutil .ReadFile ("test/arguments-parameters.yaml" )
83+ expectedPipelineFile , _ := os .ReadFile ("test/arguments-parameters.yaml" )
8584 assert .Equal (t , expectedPipelineFile , pipelineFile )
8685}
8786
8887func TestDecompressPipelineZip_MalformattedZip (t * testing.T ) {
89- zipByte , _ := ioutil .ReadFile ("test/malformatted_zip.zip" )
88+ zipByte , _ := os .ReadFile ("test/malformatted_zip.zip" )
9089 _ , err := DecompressPipelineZip (zipByte )
9190 assert .NotNil (t , err )
9291 assert .Contains (t , err .Error (), "Not a valid zip file" )
9392}
9493
9594func TestDecompressPipelineZip_MalformedZip2 (t * testing.T ) {
96- zipByte , _ := ioutil .ReadFile ("test/malformed_zip2.zip" )
95+ zipByte , _ := os .ReadFile ("test/malformed_zip2.zip" )
9796 _ , err := DecompressPipelineZip (zipByte )
9897 assert .NotNil (t , err )
9998 assert .Contains (t , err .Error (), "Not a valid zip file" )
10099}
101100
102101func TestDecompressPipelineZip_NonYamlZip (t * testing.T ) {
103- zipByte , _ := ioutil .ReadFile ("test/non_yaml_zip/non_yaml_file.zip" )
102+ zipByte , _ := os .ReadFile ("test/non_yaml_zip/non_yaml_file.zip" )
104103 _ , err := DecompressPipelineZip (zipByte )
105104 assert .NotNil (t , err )
106105 assert .Contains (t , err .Error (), "Expecting a pipeline.yaml file inside the zip" )
107106}
108107
109108func TestDecompressPipelineZip_EmptyZip (t * testing.T ) {
110- zipByte , _ := ioutil .ReadFile ("test/empty_tarball/empty.zip" )
109+ zipByte , _ := os .ReadFile ("test/empty_tarball/empty.zip" )
111110 _ , err := DecompressPipelineZip (zipByte )
112111 assert .NotNil (t , err )
113112 assert .Contains (t , err .Error (), "Not a valid zip file" )
@@ -118,7 +117,7 @@ func TestReadPipelineFile_YAML(t *testing.T) {
118117 fileBytes , err := ReadPipelineFile ("arguments-parameters.yaml" , file , common .MaxFileLength )
119118 assert .Nil (t , err )
120119
121- expectedFileBytes , _ := ioutil .ReadFile ("test/arguments-parameters.yaml" )
120+ expectedFileBytes , _ := os .ReadFile ("test/arguments-parameters.yaml" )
122121 assert .Equal (t , expectedFileBytes , fileBytes )
123122}
124123
@@ -127,7 +126,7 @@ func TestReadPipelineFile_JSON(t *testing.T) {
127126 fileBytes , err := ReadPipelineFile ("v2-hello-world.json" , file , common .MaxFileLength )
128127 assert .Nil (t , err )
129128
130- expectedFileBytes , _ := ioutil .ReadFile ("test/v2-hello-world.json" )
129+ expectedFileBytes , _ := os .ReadFile ("test/v2-hello-world.json" )
131130 assert .Equal (t , expectedFileBytes , fileBytes )
132131}
133132
@@ -136,7 +135,7 @@ func TestReadPipelineFile_Zip(t *testing.T) {
136135 pipelineFile , err := ReadPipelineFile ("arguments-parameters.zip" , file , common .MaxFileLength )
137136 assert .Nil (t , err )
138137
139- expectedPipelineFile , _ := ioutil .ReadFile ("test/arguments-parameters.yaml" )
138+ expectedPipelineFile , _ := os .ReadFile ("test/arguments-parameters.yaml" )
140139 assert .Equal (t , expectedPipelineFile , pipelineFile )
141140}
142141
@@ -145,7 +144,7 @@ func TestReadPipelineFile_Zip_AnyExtension(t *testing.T) {
145144 pipelineFile , err := ReadPipelineFile ("arguments-parameters.pipeline" , file , common .MaxFileLength )
146145 assert .Nil (t , err )
147146
148- expectedPipelineFile , _ := ioutil .ReadFile ("test/arguments-parameters.yaml" )
147+ expectedPipelineFile , _ := os .ReadFile ("test/arguments-parameters.yaml" )
149148 assert .Equal (t , expectedPipelineFile , pipelineFile )
150149}
151150
@@ -154,7 +153,7 @@ func TestReadPipelineFile_MultifileZip(t *testing.T) {
154153 pipelineFile , err := ReadPipelineFile ("pipeline_plus_component.ai-hub-package" , file , common .MaxFileLength )
155154 assert .Nil (t , err )
156155
157- expectedPipelineFile , _ := ioutil .ReadFile ("test/pipeline_plus_component/pipeline.yaml" )
156+ expectedPipelineFile , _ := os .ReadFile ("test/pipeline_plus_component/pipeline.yaml" )
158157 assert .Equal (t , expectedPipelineFile , pipelineFile )
159158}
160159
@@ -163,7 +162,7 @@ func TestReadPipelineFile_Tarball(t *testing.T) {
163162 pipelineFile , err := ReadPipelineFile ("arguments.tar.gz" , file , common .MaxFileLength )
164163 assert .Nil (t , err )
165164
166- expectedPipelineFile , _ := ioutil .ReadFile ("test/arguments-parameters.yaml" )
165+ expectedPipelineFile , _ := os .ReadFile ("test/arguments-parameters.yaml" )
167166 assert .Equal (t , expectedPipelineFile , pipelineFile )
168167}
169168
@@ -172,7 +171,7 @@ func TestReadPipelineFile_Tarball_AnyExtension(t *testing.T) {
172171 pipelineFile , err := ReadPipelineFile ("arguments.pipeline" , file , common .MaxFileLength )
173172 assert .Nil (t , err )
174173
175- expectedPipelineFile , _ := ioutil .ReadFile ("test/arguments-parameters.yaml" )
174+ expectedPipelineFile , _ := os .ReadFile ("test/arguments-parameters.yaml" )
176175 assert .Equal (t , expectedPipelineFile , pipelineFile )
177176}
178177
@@ -181,7 +180,7 @@ func TestReadPipelineFile_MultifileTarball(t *testing.T) {
181180 pipelineFile , err := ReadPipelineFile ("pipeline_plus_component.ai-hub-package" , file , common .MaxFileLength )
182181 assert .Nil (t , err )
183182
184- expectedPipelineFile , _ := ioutil .ReadFile ("test/pipeline_plus_component/pipeline.yaml" )
183+ expectedPipelineFile , _ := os .ReadFile ("test/pipeline_plus_component/pipeline.yaml" )
185184 assert .Equal (t , expectedPipelineFile , pipelineFile )
186185}
187186
0 commit comments