Skip to content

Commit

Permalink
feat : complete
Browse files Browse the repository at this point in the history
  • Loading branch information
seipan committed Sep 22, 2023
1 parent 5c6ca0d commit cd8c848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
11 changes: 2 additions & 9 deletions cmd/attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"encoding/json"
"fmt"
"net/http"
"sync"
"time"

"github.com/seipan/bulma/lib"
Expand All @@ -45,17 +44,11 @@ func ParseAndAttack(ctx context.Context, beseEndpoint string, path string, freq
return fmt.Errorf("failed to convert openapi to attacker: %w", err)
}
fmt.Println("--------------------------bulma attack start-------------------------------")
var wg sync.WaitGroup
for _, atk := range atks {
wg.Add(1)
go func() {
metrics := atk.Attack()
outputMetrics(metrics, &atk)
}()
wg.Done()
metrics := atk.Attack()
outputMetrics(metrics, &atk)
}
fmt.Println("--------------------------bulma attack finish-------------------------------")
wg.Wait()
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func init() {

// Cobra also supports local flags, which will only run
// when this action is called directly.
rootCmd.Flags().StringP("filepath", "path", "", "FilePath for Parsing OpenAPI")
rootCmd.Flags().StringP("base", "path", "", "BaseURL for stress test")
rootCmd.Flags().IntP("frequency", "frequency", 1, "stress test frequency")
rootCmd.Flags().DurationP("duration", "duration", 1, "stress test frequency")
rootCmd.Flags().StringP("path", "p", "", "FilePath for Parsing OpenAPI")
rootCmd.Flags().StringP("base", "b", "", "BaseURL for stress test")
rootCmd.Flags().IntP("frequency", "f", 1, "stress test frequency")
rootCmd.Flags().DurationP("duration", "d", 1, "stress test duration")
}

0 comments on commit cd8c848

Please sign in to comment.