5d20cf8829
* peertls: don't log errors for double close understood that this part of the code is undergoing heavy change right now, but just want to make sure this fix gets incorporated somewhere * git cleanup: node-id stuff * cleanup * rename identity_util.go * wip `CertificateAuthority` refactor * refactoring * gitignore update * wip * Merge remote-tracking branch 'storj/doubleclose' into node-id3 * storj/doubleclose: peertls: don't log errors for double close * add peertls tests & gomports * wip: + refactor + style changes + cleanup + [wip] add version to CA and identity configs + [wip] heavy client setup * refactor * wip: + refactor + style changes + add `CAConfig.Load` + add `CAConfig.Save` * wip: + add `LoadOrCreate` and `Create` to CA and Identity configs + add overwrite to CA and identity configs + heavy client setup + refactor + style changes + cleanup * wip * fixing things * fixing things * wip hc setup * hc setup: + refactor + bugfixing * improvements based on reveiw feedback * goimports * improvements: + responding to review feedback + refactor * feedback-based improvements * feedback-based improvements * feedback-based improvements * feedback-based improvements * feedback-based improvements * feedback-based improvements * cleanup * refactoring CA and Identity structs * Merge branch 'master' into node-id3 * move version field to setup config structs for CA and identity * fix typo * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * Merge branch 'master' into node-id3 * fix gateway setup finally * go imports * fix `FullCertificateAuthority.GenerateIdentity` * cleanup overlay tests * bugfixing * update ca/identity setup * go imports * fix peertls test copy/paste fail * responding to review feedback * setup tweaking * update farmer setup
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package provider
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGenerateCA(t *testing.T) {
|
|
expectedDifficulty := uint16(4)
|
|
|
|
ca, err := GenerateCA(context.Background(), expectedDifficulty, 5)
|
|
assert.NoError(t, err)
|
|
assert.NotEmpty(t, ca)
|
|
|
|
actualDifficulty := ca.ID.Difficulty()
|
|
assert.True(t, actualDifficulty >= expectedDifficulty)
|
|
}
|
|
|
|
func BenchmarkGenerateCA_Difficulty8_Concurrency1(b *testing.B) {
|
|
for i := 0; i < b.N; i++ {
|
|
expectedDifficulty := uint16(8)
|
|
GenerateCA(nil, expectedDifficulty, 1)
|
|
}
|
|
}
|
|
|
|
func BenchmarkGenerateCA_Difficulty8_Concurrency2(b *testing.B) {
|
|
for i := 0; i < b.N; i++ {
|
|
expectedDifficulty := uint16(8)
|
|
GenerateCA(nil, expectedDifficulty, 2)
|
|
}
|
|
}
|
|
|
|
func BenchmarkGenerateCA_Difficulty8_Concurrency5(b *testing.B) {
|
|
for i := 0; i < b.N; i++ {
|
|
expectedDifficulty := uint16(8)
|
|
GenerateCA(nil, expectedDifficulty, 5)
|
|
}
|
|
}
|
|
|
|
func BenchmarkGenerateCA_Difficulty8_Concurrency10(b *testing.B) {
|
|
for i := 0; i < b.N; i++ {
|
|
expectedDifficulty := uint16(8)
|
|
GenerateCA(nil, expectedDifficulty, 10)
|
|
}
|
|
}
|