@@ -458,13 +458,11 @@ func TestRunCommand_Run(t *testing.T) {
458458 }{
459459 "success, no secrets" : {
460460 command : RunCommand {
461- osEnv : func () []string { return []string {} },
462461 command : []string {"echo" , "test" },
463462 },
464463 },
465464 "missing secret" : {
466465 command : RunCommand {
467- osEnv : func () []string { return []string {} },
468466 command : []string {"echo" , "test" },
469467 envar : map [string ]string {
470468 "missing" : "path/to/unexisting/secret" ,
@@ -486,7 +484,6 @@ func TestRunCommand_Run(t *testing.T) {
486484 },
487485 "missing secret ignored" : {
488486 command : RunCommand {
489- osEnv : func () []string { return []string {} },
490487 command : []string {"echo" , "test" },
491488 envar : map [string ]string {
492489 "missing" : "path/to/unexisting/secret" ,
@@ -508,7 +505,6 @@ func TestRunCommand_Run(t *testing.T) {
508505 },
509506 "repo does not exist ignored" : {
510507 command : RunCommand {
511- osEnv : func () []string { return []string {} },
512508 command : []string {"echo" , "test" },
513509 envar : map [string ]string {
514510 "missing" : "unexisting/repo/secret" ,
@@ -530,7 +526,6 @@ func TestRunCommand_Run(t *testing.T) {
530526 },
531527 "invalid template var: start with a number" : {
532528 command : RunCommand {
533- osEnv : func () []string { return []string {} },
534529 envFile : "secrethub.env" ,
535530 templateVars : map [string ]string {
536531 "0foo" : "value" ,
@@ -541,7 +536,6 @@ func TestRunCommand_Run(t *testing.T) {
541536 },
542537 "invalid template var: illegal character" : {
543538 command : RunCommand {
544- osEnv : func () []string { return []string {} },
545539 envFile : "secrethub.env" ,
546540 templateVars : map [string ]string {
547541 "foo@bar" : "value" ,
@@ -550,6 +544,42 @@ func TestRunCommand_Run(t *testing.T) {
550544 },
551545 err : ErrInvalidTemplateVar ("foo@bar" ),
552546 },
547+ "os env secret not found" : {
548+ command : RunCommand {
549+ osEnv : []string {"TEST=secrethub://nonexistent/secret/path" },
550+ command : []string {"echo" , "test" },
551+ newClient : func () (secrethub.ClientInterface , error ) {
552+ return fakeclient.Client {
553+ SecretService : & fakeclient.SecretService {
554+ VersionService : & fakeclient.SecretVersionService {
555+ WithDataGetter : fakeclient.WithDataGetter {
556+ Err : api .ErrSecretNotFound ,
557+ },
558+ },
559+ },
560+ }, nil
561+ },
562+ },
563+ err : api .ErrSecretNotFound ,
564+ },
565+ "os env secret not found ignored" : {
566+ command : RunCommand {
567+ osEnv : []string {"TEST=secrethub://nonexistent/secret/path" },
568+ ignoreMissingSecrets : true ,
569+ command : []string {"echo" , "test" },
570+ newClient : func () (secrethub.ClientInterface , error ) {
571+ return fakeclient.Client {
572+ SecretService : & fakeclient.SecretService {
573+ VersionService : & fakeclient.SecretVersionService {
574+ WithDataGetter : fakeclient.WithDataGetter {
575+ Err : api .ErrSecretNotFound ,
576+ },
577+ },
578+ },
579+ }, nil
580+ },
581+ },
582+ },
553583 }
554584
555585 for name , tc := range cases {
0 commit comments