@@ -26,15 +26,24 @@ import (
2626
2727func TestGenerate (t * testing.T ) {
2828 cmdtest .RequireCommand (t , "protoc" )
29+ cmdtest .RequireCommand (t , "rustfmt" )
30+ cmdtest .RequireCommand (t , "taplo" )
2931 testdataDir , err := filepath .Abs ("../../../sidekick/testdata" )
3032 if err != nil {
3133 t .Fatal (err )
3234 }
3335
34- outDir := t .TempDir ()
36+ // Change to testdata directory so cargo fmt can find Cargo.toml
37+ workspaceDir , err := filepath .Abs ("testdata" )
38+ if err != nil {
39+ t .Fatal (err )
40+ }
41+ outDir := filepath .Join (workspaceDir , "google-cloud-secretmanager-v1" )
42+ t .Cleanup (func () { os .RemoveAll (outDir ) })
43+ t .Chdir (workspaceDir )
3544 googleapisDir := filepath .Join (testdataDir , "googleapis" )
3645 library := & config.Library {
37- Name : "secretmanager" ,
46+ Name : "google-cloud- secretmanager-v1 " ,
3847 Version : "0.1.0" ,
3948 Output : outDir ,
4049 ReleaseLevel : "preview" ,
@@ -45,6 +54,15 @@ func TestGenerate(t *testing.T) {
4554 ServiceConfig : "google/cloud/secretmanager/v1/secretmanager_v1.yaml" ,
4655 },
4756 },
57+ Rust : & config.RustCrate {
58+ RustDefault : config.RustDefault {
59+ PackageDependencies : []* config.RustPackageDependency {
60+ {Name : "wkt" , Package : "google-cloud-wkt" , Source : "google.protobuf" },
61+ {Name : "iam_v1" , Package : "google-cloud-iam-v1" , Source : "google.iam.v1" },
62+ {Name : "location" , Package : "google-cloud-location" , Source : "google.cloud.location" },
63+ },
64+ },
65+ },
4866 }
4967 sources := & config.Sources {
5068 Googleapis : & config.Source {Dir : googleapisDir },
@@ -58,7 +76,7 @@ func TestGenerate(t *testing.T) {
5876 want string
5977 }{
6078 {filepath .Join (outDir , "Cargo.toml" ), "name" },
61- {filepath .Join (outDir , "Cargo.toml" ), "secretmanager" },
79+ {filepath .Join (outDir , "Cargo.toml" ), "google-cloud- secretmanager-v1 " },
6280 {filepath .Join (outDir , "README.md" ), "# Google Cloud Client Libraries for Rust - Secret Manager API" },
6381 {filepath .Join (outDir , "src" , "lib.rs" ), "pub mod model;" },
6482 {filepath .Join (outDir , "src" , "lib.rs" ), "pub mod client;" },
0 commit comments