Skip to content

Commit

Permalink
adding partition attributes to faker generator
Browse files Browse the repository at this point in the history
  • Loading branch information
aviaIguazio committed Jul 14, 2019
1 parent 238ec86 commit 35053bd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
23 changes: 23 additions & 0 deletions examples/faker_2_kv_example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
title = "Workload example"

[global]
Duration = "160s"
server="webapi.default-tenant.app.hostname.lab.iguazeng.com"
port="8081"
TLSMode=false
[global.StatusCodesAcceptance]
200 = 100.0 # upto 100% return status of 200
204 = 100.0
205 = 100.0

[workloads]
[workloads.load_faker_to_kv]
name="faker_to_kv"
count=1
Generator="faker2kv"
container="bigdata"
lazy=10
Target="faker2kv/"
workers=1
[workloads.load_faker_to_kv.Header]
"Authorization"="Basic abcdefg"
23 changes: 13 additions & 10 deletions httpblaster/data_generator/fakerGenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ type Fake struct {
JobTitle string
Password string
CurrencyShort string
Year string
Month string
Day string
Hour string
Year string `json:"year"`
Month string `json:"month"`
Day string `json:"day"`
Hour string `json:"hour"`
}

func randomBase64String(l int) string {
buff := make([]byte, int(math.Round(float64(l)/float64(1.33333333333))))
rand.Read(buff)
_, err := rand.Read(buff)
if err != nil {
panic(err)
}
str := base64.RawURLEncoding.EncodeToString(buff)
return str[:l] // strip 1 extra character we get from odd length results
}
Expand Down Expand Up @@ -84,10 +87,10 @@ func (self *Fake) ConvertToIgzEmdItemJson() string {
emdItem.InsertItemAttr("HackerPhrase", igz_data.T_STRING, self.HackerPhrase)
emdItem.InsertItemAttr("JobTitle", igz_data.T_STRING, self.JobTitle)
emdItem.InsertItemAttr("Password", igz_data.T_STRING, self.Password)
emdItem.InsertItemAttr("Year", igz_data.T_NUMBER, self.Year)
emdItem.InsertItemAttr("Month", igz_data.T_NUMBER, self.Month)
emdItem.InsertItemAttr("Day", igz_data.T_NUMBER, self.Day)
emdItem.InsertItemAttr("Hour", igz_data.T_NUMBER, self.Hour)
log.Info(emdItem.ToJsonString())
emdItem.InsertItemAttr("year", igz_data.T_NUMBER, self.Year)
emdItem.InsertItemAttr("month", igz_data.T_NUMBER, self.Month)
emdItem.InsertItemAttr("day", igz_data.T_NUMBER, self.Day)
emdItem.InsertItemAttr("hour", igz_data.T_NUMBER, self.Hour)
log.Debug(emdItem.ToJsonString())
return emdItem.ToJsonString()
}

0 comments on commit 35053bd

Please sign in to comment.