github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/ais/test/dsort_script_test.go (about)

     1  // Package integration_test.
     2  /*
     3   * Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package integration_test
     6  
     7  import (
     8  	"os/exec"
     9  	"testing"
    10  
    11  	"github.com/NVIDIA/aistore/api/apc"
    12  	"github.com/NVIDIA/aistore/cmn"
    13  	"github.com/NVIDIA/aistore/tools/tassert"
    14  	"github.com/NVIDIA/aistore/tools/tlog"
    15  	"github.com/NVIDIA/aistore/tools/trand"
    16  )
    17  
    18  func TestDistributedSortUsingScripts(t *testing.T) {
    19  	for _, spec := range []string{"dsort-spec1.json", "dsort-spec2.json", "dsort-spec3.json"} {
    20  		t.Run(spec, func(t *testing.T) {
    21  			var (
    22  				src     = cmn.Bck{Name: "src_" + trand.String(6), Provider: apc.AIS}
    23  				srcName = src.Cname("")
    24  				dst     = cmn.Bck{Name: "dst_" + trand.String(6), Provider: apc.AIS}
    25  				dstName = dst.Cname("")
    26  
    27  				cmd = exec.Command("./scripts/dsort-ex1.sh", "--srcbck", srcName, "--dstbck", dstName)
    28  			)
    29  			cmd.Args = append(cmd.Args, "--spec", spec)
    30  
    31  			out, err := cmd.CombinedOutput()
    32  			if len(out) > 0 {
    33  				tlog.Logln(string(out))
    34  			}
    35  			tassert.CheckFatal(t, err)
    36  		})
    37  	}
    38  }