8
8
"context"
9
9
"flag"
10
10
"fmt"
11
+ "github.com/kylelemons/godebug/pretty"
12
+ "github.com/vmware-tanzu/sonobuoy/pkg/client/results"
13
+ yaml "gopkg.in/yaml.v2"
11
14
"os"
12
15
"os/exec"
13
16
"path/filepath"
@@ -16,10 +19,6 @@ import (
16
19
"strings"
17
20
"testing"
18
21
"time"
19
-
20
- "github.com/kylelemons/godebug/pretty"
21
- "github.com/vmware-tanzu/sonobuoy/pkg/client/results"
22
- yaml "gopkg.in/yaml.v2"
23
22
)
24
23
25
24
const (
@@ -375,60 +374,6 @@ func TestQuick(t *testing.T) {
375
374
})
376
375
}
377
376
378
- // TestQuickLegacyFix runs a real "--mode quick" check against the cluster with the yaml from v0.54.0
379
- // which suffered from issues with agreement regarding ResultsDir.
380
- func TestQuickLegacyFix (t * testing.T ) {
381
- t .Parallel ()
382
- ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
383
- defer cancel ()
384
-
385
- // Hardcoded namespace due to nature of test being from a file.
386
- ns , cleanup := getNamespace (t )
387
- // Doing a deletion check here rather than as a separate test so-as not to waste the extra compute time.
388
- defer func (t * testing.T , ns string ) {
389
- if err := deleteComplete (t , ns ); err != nil {
390
- t .Fatalf ("Failed to completely delete resources: %v" , err )
391
- }
392
- }(t , ns )
393
- defer cleanup (true )
394
-
395
- // Get and modify data so it targets the right sonobuoy image and namespace.
396
- runData , err := os .ReadFile ("./testdata/issue1688.yaml" )
397
- if err != nil {
398
- t .Fatalf ("Failed to read run data file: %v" , err )
399
- }
400
-
401
- tmpfile , err := os .CreateTemp ("" , "" )
402
- if err != nil {
403
- t .Fatalf ("Failed to create necessary tmpfile: %v" , err )
404
- }
405
-
406
- curVersion := mustRunSonobuoyCommandWithContext (context .Background (), t , ns , "version --short" )
407
- imgName := strings .TrimSpace (fmt .Sprintf ("sonobuoy/sonobuoy:%v" , curVersion .String ()))
408
- runData = bytes .ReplaceAll (runData , []byte ("REPLACE_NS" ), []byte (ns ))
409
- runData = bytes .ReplaceAll (runData , []byte ("REPLACE_IMAGE" ), []byte (imgName ))
410
-
411
- if _ , err := tmpfile .Write (runData ); err != nil {
412
- t .Fatalf ("Failed to rewrite test data as needed for 1688 test: %v" , err )
413
- }
414
- if err := tmpfile .Close (); err != nil {
415
- t .Fatalf ("Failed to close tmpfile: %v" , err )
416
- }
417
-
418
- // Use kubectl to apply the run so that we don't have the CLI modifying the data.
419
- args := fmt .Sprintf ("apply -f %v" , tmpfile .Name ())
420
- if out , err := runCommandWithContext (context .TODO (), t , kubectl , args ); err != nil {
421
- t .Fatalf ("Failed to launch run for 1688: %v %v" , err , out .String ())
422
- }
423
-
424
- // Now we can use sonobuoy to wait for results.
425
- mustRunSonobuoyCommandWithContext (ctx , t , ns , fmt .Sprintf ("wait -n %v" , ns ))
426
-
427
- checkStatusForPluginErrors (ctx , t , ns , "e2ecustom" , 0 )
428
- tb := mustDownloadTarball (ctx , t , ns )
429
- tb = saveToArtifacts (t , tb )
430
- }
431
-
432
377
// deleteComplete is the logic that checks that we deleted the namespace and our clusterRole[Bindings]
433
378
func deleteComplete (t * testing.T , ns string ) error {
434
379
out , err := runCommandWithContext (context .TODO (), t , kubectl , fmt .Sprintf ("get clusterroles sonobuoy-serviceaccount-%v -o yaml" , ns ))
0 commit comments