1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-15 07:43:21 +00:00

Don't parse test parameters in init()

This is to make test parameter parsing work with newer versions
of Go
This commit is contained in:
Gilbert Chen
2022-04-07 22:31:18 -04:00
parent 68b60499d7
commit a953c4ec28
5 changed files with 52 additions and 63 deletions

View File

@@ -62,7 +62,7 @@ func TestChunkBasic(t *testing.T) {
config.CompressionLevel = DEFAULT_COMPRESSION_LEVEL
maxSize := 1000000
if testRSAEncryption {
if *testRSAEncryption {
privateKey, err := rsa.GenerateKey(crypto_rand.Reader, 2048)
if err != nil {
t.Errorf("Failed to generate a random private key: %v", err)
@@ -71,7 +71,7 @@ func TestChunkBasic(t *testing.T) {
config.rsaPublicKey = privateKey.Public().(*rsa.PublicKey)
}
if testErasureCoding {
if *testErasureCoding {
config.DataShards = 5
config.ParityShards = 2
}
@@ -98,7 +98,7 @@ func TestChunkBasic(t *testing.T) {
encryptedData := make([]byte, chunk.GetLength())
copy(encryptedData, chunk.GetBytes())
if testErasureCoding {
if *testErasureCoding {
offset := 24 + 32 * 7
start := rand.Int() % (len(encryptedData) - offset) + offset
length := (len(encryptedData) - offset) / 7