Files
teleport/lib/cache/recording_encryption_test.go
rosstimothy 4f17314a11 Initial migration to the Opaque API (#67279)
* Convert existing non-gogo codegen to the Hybrid API

Contributes to https://github.com/gravitational/teleport/issues/66776.

All existing protos explicitly set to API_OPEN have been change to
API_HBYRID. The new codegen was performed via make grpc. There are no
other functional changes to the code to start consuming the Hybrid API
those will come later. The intent is to get all Hybrid codegen in and
backported to ease the transition.

* Initial migration to the Opaque API

Contributes to https://github.com/gravitational/teleport/issues/66776.

All of the changes here are mechanical conversions generated from
`open2opaque rewrite -levels=green ./...`. There will be a follow up
to this in teleport.e which does the same. Once all changes have been
merged the process will be repeated with -levels=yellow followed by
-levels=red.


See https://protobuf.dev/reference/go/opaque-migration/ for more
details.
2026-06-05 14:52:58 +00:00

58 lines
2.1 KiB
Go

// Teleport
// Copyright (C) 2025 Gravitational, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cache
import (
"testing"
"testing/synctest"
headerv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/header/v1"
recordingencryptionv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/recordingencryption/v1"
"github.com/gravitational/teleport/api/types"
)
func newRecordingEncryption() *recordingencryptionv1.RecordingEncryption {
return recordingencryptionv1.RecordingEncryption_builder{
Kind: types.KindRecordingEncryption,
Version: types.V1,
Metadata: headerv1.Metadata_builder{
Name: types.MetaNameRecordingEncryption,
}.Build(),
Spec: recordingencryptionv1.RecordingEncryptionSpec_builder{
ActiveKeyPairs: nil,
}.Build(),
}.Build()
}
// TestRecordingEncryption tests that CRUD operations on the RecordingEncryption resource are
// replicated from the backend to the cache.
func TestRecordingEncryption(t *testing.T) {
synctest.Test(t, func(t *testing.T) {
p := newTestPack(t, ForAuth)
t.Cleanup(p.Close)
testSingleton153(t, p, testSingletonFuncs153[*recordingencryptionv1.RecordingEncryption]{
newResource: newRecordingEncryption,
create: p.recordingEncryption.CreateRecordingEncryption,
update: p.recordingEncryption.UpdateRecordingEncryption,
get: p.recordingEncryption.GetRecordingEncryption,
cacheGet: p.cache.GetRecordingEncryption,
delete: p.recordingEncryption.DeleteRecordingEncryption,
})
})
}