@@ -608,11 +608,8 @@ func TestProxyRegisterDeregister(t *testing.T) {
608
608
func TestIssueSignedAppToken (t * testing.T ) {
609
609
t .Parallel ()
610
610
611
- db , pubsub := dbtestutil .NewDB (t )
612
- client , user := coderdenttest .New (t , & coderdenttest.Options {
611
+ client , db , user := coderdenttest .NewWithDatabase (t , & coderdenttest.Options {
613
612
Options : & coderdtest.Options {
614
- Database : db ,
615
- Pubsub : pubsub ,
616
613
IncludeProvisionerDaemon : true ,
617
614
},
618
615
LicenseOptions : & coderdenttest.LicenseOptions {
@@ -622,6 +619,10 @@ func TestIssueSignedAppToken(t *testing.T) {
622
619
},
623
620
})
624
621
622
+ _ = dbgen .CryptoKey (t , db , database.CryptoKey {
623
+ Feature : database .CryptoKeyFeatureWorkspaceAppsToken ,
624
+ })
625
+
625
626
// Create a workspace + apps
626
627
authToken := uuid .NewString ()
627
628
version := coderdtest .CreateTemplateVersion (t , client , user .OrganizationID , & echo.Responses {
@@ -715,6 +716,10 @@ func TestReconnectingPTYSignedToken(t *testing.T) {
715
716
closer .Close ()
716
717
})
717
718
719
+ _ = dbgen .CryptoKey (t , db , database.CryptoKey {
720
+ Feature : database .CryptoKeyFeatureWorkspaceAppsToken ,
721
+ })
722
+
718
723
// Create a workspace + apps
719
724
authToken := uuid .NewString ()
720
725
version := coderdtest .CreateTemplateVersion (t , client , user .OrganizationID , & echo.Responses {
@@ -945,16 +950,14 @@ func TestGetCryptoKeys(t *testing.T) {
945
950
keys , err := proxy .SDKClient .CryptoKeys (ctx , codersdk .CryptoKeyFeatureWorkspaceAppsAPIKey )
946
951
require .NoError (t , err )
947
952
require .NotEmpty (t , keys )
948
- // 1 key is generated on startup, the other is the one we generated for our test.
949
- require .Equal (t , 2 , len (keys .CryptoKeys ))
953
+ require .Equal (t , 1 , len (keys .CryptoKeys ))
950
954
requireContainsKeys (t , keys .CryptoKeys , encryptionKey )
951
- requireNotContainsKeys (t , keys .CryptoKeys , signingKey )
952
955
953
956
keys , err = proxy .SDKClient .CryptoKeys (ctx , codersdk .CryptoKeyFeatureWorkspaceAppsToken )
954
957
require .NoError (t , err )
955
958
require .NotEmpty (t , keys )
959
+ require .Equal (t , 1 , len (keys .CryptoKeys ))
956
960
requireContainsKeys (t , keys .CryptoKeys , signingKey )
957
- requireNotContainsKeys (t , keys .CryptoKeys , encryptionKey )
958
961
})
959
962
960
963
t .Run ("InvalidFeature" , func (t * testing.T ) {
@@ -1027,18 +1030,6 @@ func TestGetCryptoKeys(t *testing.T) {
1027
1030
})
1028
1031
}
1029
1032
1030
- func requireNotContainsKeys (t * testing.T , keys []codersdk.CryptoKey , unexpected ... codersdk.CryptoKey ) {
1031
- t .Helper ()
1032
-
1033
- for _ , expectedKey := range unexpected {
1034
- for _ , key := range keys {
1035
- if key .Feature == expectedKey .Feature && key .Sequence == expectedKey .Sequence {
1036
- t .Fatalf ("unexpected key %+v found" , expectedKey )
1037
- }
1038
- }
1039
- }
1040
- }
1041
-
1042
1033
func requireContainsKeys (t * testing.T , keys []codersdk.CryptoKey , expected ... codersdk.CryptoKey ) {
1043
1034
t .Helper ()
1044
1035
0 commit comments