Permalink
Browse files

New config setting: downloadSpeedLimit to limit download speed. #62

  • Loading branch information...
smira committed Jul 13, 2014
1 parent fb1e28b commit a54a366c95647959a578da589f45b42425316581
Showing with 22 additions and 3 deletions.
  1. +17 −2 system/lib.py
  2. +2 −1 system/t02_config/CreateConfigTest_gold
  3. +2 −0 utils/config.go
  4. +1 −0 utils/config_test.go
View
@@ -219,11 +219,26 @@ def delete_file(self, path):
def check_file_contents(self, path, gold_name, match_prepare=None):
contents = self.read_file(path)
try:
self.verify_match(self.get_gold(gold_name), contents, match_prepare=match_prepare)
self.verify_match(self.get_gold(gold_name), contents, match_prepare=match_prepare)
except:
if self.captureResults:
with open(self.get_gold_filename(gold_name), "w") as f:
f.write(contents)
else:
raise
def check_file(self):
self.verify_match(self.get_gold(), open(self.checkedFile, "r").read())
contents = open(self.checkedFile, "r").read()
try:
self.verify_match(self.get_gold(), contents)
except:
if self.captureResults:
with open(self.get_gold_filename(), "w") as f:
f.write(contents)
else:
raise
def check_exists(self, path):
if not os.path.exists(os.path.join(os.environ["HOME"], ".aptly", path)):
@@ -1,6 +1,7 @@
{
"rootDir": "${HOME}/.aptly",
"rootDir": "/Users/smira/.aptly",
"downloadConcurrency": 4,
"downloadSpeedLimit": 0,
"architectures": [],
"dependencyFollowSuggests": false,
"dependencyFollowRecommends": false,
View
@@ -10,6 +10,7 @@ import (
type ConfigStructure struct {
RootDir string `json:"rootDir"`
DownloadConcurrency int `json:"downloadConcurrency"`
DownloadLimit int64 `json:"downloadSpeedLimit"`
Architectures []string `json:"architectures"`
DepFollowSuggests bool `json:"dependencyFollowSuggests"`
DepFollowRecommends bool `json:"dependencyFollowRecommends"`
@@ -26,6 +27,7 @@ type ConfigStructure struct {
var Config = ConfigStructure{
RootDir: filepath.Join(os.Getenv("HOME"), ".aptly"),
DownloadConcurrency: 4,
DownloadLimit: 0,
Architectures: []string{},
DepFollowSuggests: false,
DepFollowRecommends: false,
View
@@ -44,6 +44,7 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
"{\n"+
" \"rootDir\": \"/tmp/aptly\",\n"+
" \"downloadConcurrency\": 5,\n"+
" \"downloadSpeedLimit\": 0,\n"+
" \"architectures\": null,\n"+
" \"dependencyFollowSuggests\": false,\n"+
" \"dependencyFollowRecommends\": false,\n"+

0 comments on commit a54a366

Please sign in to comment.