-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from KevinPike/rabbitmq
Address RabbitMQ feedback
- Loading branch information
Showing
11 changed files
with
259 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# RabbitMQ Backend | ||
|
||
## Testing | ||
|
||
There are unit and integration RabbitMQ backend tests. Unit tests can be run by `go test`. Integration tests require setting the following environment variables: | ||
``` | ||
RABBITMQ_CONNECTION_URI= | ||
RABBITMQ_USERNAME= | ||
RABBITMQ_PASSWORD= | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package rabbitmq | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/vault/logical/framework" | ||
) | ||
|
||
type validateLeasesTestCase struct { | ||
Lease int | ||
LeaseMax int | ||
Fail bool | ||
} | ||
|
||
func TestConfigLease_validateLeases(t *testing.T) { | ||
cases := map[string]validateLeasesTestCase{ | ||
"Both lease and lease max": { | ||
Lease: 60 * 60, | ||
LeaseMax: 60 * 60, | ||
}, | ||
"Just lease": { | ||
Lease: 60 * 60, | ||
LeaseMax: 0, | ||
}, | ||
"No lease nor lease max": { | ||
Lease: 0, | ||
LeaseMax: 0, | ||
Fail: true, | ||
}, | ||
} | ||
|
||
data := &framework.FieldData{ | ||
Schema: configFields(), | ||
} | ||
for name, c := range cases { | ||
data.Raw = map[string]interface{}{ | ||
leaseLabel: c.Lease, | ||
leaseMaxLabel: c.LeaseMax, | ||
} | ||
|
||
_, _, err := validateLeases(data) | ||
if err != nil && c.Fail { | ||
// This was expected | ||
continue | ||
} else if err != nil { | ||
// This was unexpected | ||
t.Errorf("Failed: %s", name) | ||
} else if err == nil && c.Fail { | ||
// This was unexpected | ||
t.Errorf("Failed to fail: %s", name) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.