<commit_before>package commands

import (
	boshlog "bosh/logger"
	boshsys "bosh/system"
	fakesys "bosh/system/fakes"
	"github.com/stretchr/testify/assert"
	"os"
	"path/filepath"
	"testing"
)

func TestCompressFilesInDir(t *testing.T) {
	fs, cmdRunner := getCompressorDependencies()
	dc := NewTarballCompressor(cmdRunner, fs)

	srcDir := fixtureSrcDir(t)
	tgzName, err := dc.CompressFilesInDir(srcDir)
	assert.NoError(t, err)

	defer os.Remove(tgzName)

	dstDir := createdTmpDir(t, fs)
	defer os.RemoveAll(dstDir)

	_, _, err = cmdRunner.RunCommand("tar", "--no-same-owner", "-xzpf", tgzName, "-C", dstDir)
	assert.NoError(t, err)

	tarDirStat, err := os.Stat(dstDir)
	assert.NoError(t, err)
	assert.Equal(t, os.FileMode(0755), tarDirStat.Mode().Perm())

	// regular files
	content, err := fs.ReadFile(dstDir + "/app.stdout.log")
	assert.NoError(t, err)
	assert.Contains(t, content, "this is app stdout")

	content, err = fs.ReadFile(dstDir + "/app.stderr.log")
	assert.NoError(t, err)
	assert.Contains(t, content, "this is app stderr")

	// file in a directory
	content, err = fs.ReadFile(dstDir + "/other_logs/other_app.stdout.log")
	assert.NoError(t, err)
	assert.Contains(t, content, "this is other app stdout")
}<commit_msg>Removed invalid test since copier was extracted from tar compressor<commit_after>package commands

import (
	boshlog "bosh/logger"
	boshsys "bosh/system"
	fakesys "bosh/system/fakes"
	"github.com/stretchr/testify/assert"
	"os"
	"path/filepath"
	"testing"
)

func TestCompressFilesInDir(t *testing.T) {
	fs, cmdRunner := getCompressorDependencies()
	dc := NewTarballCompressor(cmdRunner, fs)

	srcDir := fixtureSrcDir(t)
	tgzName, err := dc.CompressFilesInDir(srcDir)
	assert.NoError(t, err)

	defer os.Remove(tgzName)

	dstDir := createdTmpDir(t, fs)
	defer os.RemoveAll(dstDir)

	_, _, err = cmdRunner.RunCommand("tar", "--no-same-owner", "-xzpf", tgzName, "-C", dstDir)
	assert.NoError(t, err)

	// regular files
	content, err := fs.ReadFile(dstDir + "/app.stdout.log")
	assert.NoError(t, err)
	assert.Contains(t, content, "this is app stdout")

	content, err = fs.ReadFile(dstDir + "/app.stderr.log")
	assert.NoError(t, err)
	assert.Contains(t, content, "this is app stderr")

	// file in a directory
	content, err = fs.ReadFile(dstDir + "/other_logs/other_app.stdout.log")
	assert.NoError(t, err)
	assert.Contains(t, content, "this is other app stdout")
}
{'fraction_non_alphanumeric': 0.15249266862170088, 'fraction_numerical': 0.0016757436112274822, 'mean_word_length': 4.867321867321867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1692416', 'n_tokens_mistral': 932, 'n_tokens_neox': 900, 'n_words': 193}