func GenerateTest(name string, applicationPath string) error {
	testRoot := path.Join("integration", "upload", "tests", name)
	if err := os.MkdirAll(testRoot, 0755); err != nil {
		return errors.Wrap(err, "failed to create test root")
	}

	inputRoot := path.Join(testRoot, "input")
	if err := os.MkdirAll(inputRoot, 0755); err != nil {
		return errors.Wrap(err, "failed to create input root")
	}

	err := copy.Copy(applicationPath, inputRoot)
	if err != nil {
		return errors.Wrap(err, "failed to copy input")
	}

	// Create the expected archive
	tarGz := archiver.TarGz{
		Tar: &archiver.Tar{
			ImplicitTopLevelFolder: true,
		},
	}

	paths := []string{
		path.Join(applicationPath, "upstream"),
		path.Join(applicationPath, "base"),
		path.Join(applicationPath, "overlays"),
	}

	if err := tarGz.Archive(paths, path.Join(testRoot, "expected-archive.tar.gz")); err != nil {
		return errors.Wrap(err, "failed to create tar gz")
	}

	return nil
}
// GenerateTest will create a new upload test fixture for integration tests
GenerateTest will create a new upload test fixture for integration tests
// GenerateTest will create a new upload test fixture for integration tests
func GenerateTest(name string, applicationPath string) error {
	testRoot := path.Join("integration", "upload", "tests", name)
	if err := os.MkdirAll(testRoot, 0755); err != nil {
		return errors.Wrap(err, "failed to create test root")
	}
	inputRoot := path.Join(testRoot, "input")
	if err := os.MkdirAll(inputRoot, 0755); err != nil {
		return errors.Wrap(err, "failed to create input root")
	}
	err := copy.Copy(applicationPath, inputRoot)
	if err != nil {
		return errors.Wrap(err, "failed to copy input")
	}
	tarGz := archiver.TarGz{
		Tar: &archiver.Tar{
			ImplicitTopLevelFolder: true,
		},
	}
	paths := []string{
		path.Join(applicationPath, "upstream"),
		path.Join(applicationPath, "base"),
		path.Join(applicationPath, "overlays"),
	}
	if err := tarGz.Archive(paths, path.Join(testRoot, "expected-archive.tar.gz")); err != nil {
		return errors.Wrap(err, "failed to create tar gz")
	}
	return nil
}
func GenerateTest ( name string , applicationPath string ) error { testRoot := path . Join ( " " , " " , " " , name ) if err := os . MkdirAll ( testRoot , 0755 ) ; err != nil { return errors . Wrap ( err , " " ) } inputRoot := path . Join ( testRoot , " " ) if err := os . MkdirAll ( inputRoot , 0755 ) ; err != nil { return errors . Wrap ( err , " " ) } err := copy . Copy ( applicationPath , inputRoot ) if err != nil { return errors . Wrap ( err , " " ) } tarGz := archiver . TarGz { Tar : & archiver . Tar { ImplicitTopLevelFolder : true , } , } paths := [ ] string { path . Join ( applicationPath , " " ) , path . Join ( applicationPath , " " ) , path . Join ( applicationPath , " " ) , } if err := tarGz . Archive ( paths , path . Join ( testRoot , " " ) ) ; err != nil { return errors . Wrap ( err , " " ) } return nil }
GenerateTest will create a new upload test fixture for integration tests
GenerateTest will create a new upload test fixture for integration tests
// Create the expected archive