in load_tests/validation/validate.go [31:89]
func main() {
// Define flags
region := flag.String("region", "", "AWS Region")
bucket := flag.String("bucket", "", "S3 Bucket Name")
logGroup := flag.String("log-group", "", "CloudWatch Log Group Name")
prefix := flag.String("prefix", "", "Log Prefix")
destination := flag.String("destination", "", "Log Destination (s3 or cloudwatch)")
inputRecord := flag.Int("input-record", 0, "Total input record number")
logDelay := flag.String("log-delay", "", "Log delay")
// Parse flags
flag.Parse()
// Validate required flags
if *region == "" {
exitErrorf("[TEST FAILURE] AWS Region required. Use the -region flag.")
}
if *bucket == "" {
exitErrorf("[TEST FAILURE] Bucket name required. Use the -bucket flag.")
}
if *logGroup == "" {
exitErrorf("[TEST FAILURE] Log group name required. Use the -log-group flag.")
}
if *prefix == "" {
exitErrorf("[TEST FAILURE] Object prefix required. Use the -prefix flag.")
}
if *destination == "" {
exitErrorf("[TEST FAILURE] Log destination for validation required. Use the -destination flag.")
}
if *inputRecord == 0 {
exitErrorf("[TEST FAILURE] Total input record number required. Use the -input-record flag.")
}
if *logDelay == "" {
exitErrorf("[TEST FAILURE] Log delay required. Use the -log-delay flag.")
}
// Map for counting unique records in corresponding destination
inputMap = make(map[uint32]struct{}, *inputRecord)
totalRecordFound := 0
if *destination == "s3" || *destination == "kinesis" || *destination == "firehose" {
s3Client, err := getS3Client(*region)
if err != nil {
exitErrorf("[TEST FAILURE] Unable to create new S3 client: %v", err)
}
totalRecordFound = validate_s3(s3Client, *bucket, *prefix)
} else if *destination == "cloudwatch" {
cwClient, err := getCWClient(*region)
if err != nil {
exitErrorf("[TEST FAILURE] Unable to create new CloudWatch client: %v", err)
}
totalRecordFound = validate_cloudwatch(cwClient, *logGroup, *prefix)
}
// Get benchmark results based on log loss, log delay and log duplication
get_results(*inputRecord, totalRecordFound, *logDelay)
}