Files
shadowdaoandClaude Sonnet 5.5 962d708fdd Rename Go module paths to repo.anhonesthost.net/CyberCoveLLC/threshold
Rename root, api and sdk module paths (imports, go.mod, go_package,
ldflags, build scripts, buf configs) and regenerate protobuf/gateway
code with the project's pinned toolchain. Wire identifiers unchanged.
api gets a local replace for sdk; root/api/sdk require v0.1.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:33:41 -07:00

45 lines
1.3 KiB
Go

// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1
package controller
import (
"context"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/db"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/kms"
"github.com/stretchr/testify/assert"
)
func Test_AllRewrapTablesRegistered(t *testing.T) {
t.Parallel()
ctx := context.Background()
conn, _ := db.TestSetup(t, "postgres")
extWrapper := db.TestWrapper(t)
kmsCache := kms.TestKms(t, conn, extWrapper)
tables, err := kmsCache.ListDataKeyVersionReferencers(ctx)
assert.NoError(t, err)
var filteredTables []string
// there are some tables we know won't be rewrapped
for _, table := range tables {
// oplog entries cannot be rewrapped at this time
if table == "oplog_entry" {
continue
}
// kms_data_key_version_destruction_job does not contain encrypted data, only a reference to the key versions
if table == "kms_data_key_version_destruction_job" {
continue
}
// all other tables should be registered
filteredTables = append(filteredTables, table)
}
assert.Empty(t, cmp.Diff(filteredTables, kms.ListTablesSupportingRewrap(), cmpopts.SortSlices(func(i, j string) bool { return i < j })), "At least one table referencing a data key does not have a rewrapping function registered")
}