You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/01/02 17:16:51 UTC

[01/17] git commit: [#6388] always load test.ini from the Allura/ dir

Updated Branches:
  refs/heads/master 733794763 -> 1bb460c6e


[#6388] always load test.ini from the Allura/ dir

This allows us to not duplicate test.ini in every dir (any local
changes required should be accomplished via mocks).

We can also can run functional tests from any directory now.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0f9768d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0f9768d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0f9768d5

Branch: refs/heads/master
Commit: 0f9768d51bf2ab5a360863d7516850ae0570de20
Parents: aa72380
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Dec 17 19:17:37 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:19 2014 +0000

----------------------------------------------------------------------
 AlluraTest/alluratest/controller.py |  3 +-
 ForgeActivity/test.ini              | 69 --------------------------------
 ForgeBlog/test.ini                  | 67 -------------------------------
 ForgeChat/test.ini                  | 67 -------------------------------
 ForgeDiscussion/test.ini            | 67 -------------------------------
 ForgeGit/test.ini                   | 67 -------------------------------
 ForgeImporters/test.ini             | 67 -------------------------------
 ForgeLink/test.ini                  | 67 -------------------------------
 ForgeSVN/test.ini                   | 67 -------------------------------
 ForgeShortUrl/test.ini              | 67 -------------------------------
 ForgeTracker/test.ini               | 67 -------------------------------
 ForgeUserStats/test.ini             | 67 -------------------------------
 ForgeWiki/test.ini                  | 67 -------------------------------
 13 files changed, 2 insertions(+), 807 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index 4c3c4e5..62cc03c 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -33,6 +33,7 @@ from webob import Request, Response
 import ew
 from ming.orm import ThreadLocalORMSession
 import ming.orm
+import pkg_resources
 
 from allura import model as M
 import allura.lib.security
@@ -56,7 +57,7 @@ def get_config_file(config=None):
     try:
         conf_dir = tg.config.here
     except AttributeError:
-        conf_dir = os.getcwd()
+        conf_dir = pkg_resources.resource_filename('Allura', '..')
     return os.path.join(conf_dir, config)
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeActivity/test.ini
----------------------------------------------------------------------
diff --git a/ForgeActivity/test.ini b/ForgeActivity/test.ini
deleted file mode 100644
index b522f20..0000000
--- a/ForgeActivity/test.ini
+++ /dev/null
@@ -1,69 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-activitystream.recording.enabled = true
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgeactivity
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeBlog/test.ini
----------------------------------------------------------------------
diff --git a/ForgeBlog/test.ini b/ForgeBlog/test.ini
deleted file mode 100644
index e29c4a3..0000000
--- a/ForgeBlog/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgeblog
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeChat/test.ini
----------------------------------------------------------------------
diff --git a/ForgeChat/test.ini b/ForgeChat/test.ini
deleted file mode 100644
index 55b5d76..0000000
--- a/ForgeChat/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgechat
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeDiscussion/test.ini
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/test.ini b/ForgeDiscussion/test.ini
deleted file mode 100644
index 1d2afd7..0000000
--- a/ForgeDiscussion/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgediscussion
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeGit/test.ini
----------------------------------------------------------------------
diff --git a/ForgeGit/test.ini b/ForgeGit/test.ini
deleted file mode 100644
index fa59b5b..0000000
--- a/ForgeGit/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgegit
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeImporters/test.ini
----------------------------------------------------------------------
diff --git a/ForgeImporters/test.ini b/ForgeImporters/test.ini
deleted file mode 100644
index 0d39a4e..0000000
--- a/ForgeImporters/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgeshorturl
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeLink/test.ini
----------------------------------------------------------------------
diff --git a/ForgeLink/test.ini b/ForgeLink/test.ini
deleted file mode 100644
index 5b959b0..0000000
--- a/ForgeLink/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgelink
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeSVN/test.ini
----------------------------------------------------------------------
diff --git a/ForgeSVN/test.ini b/ForgeSVN/test.ini
deleted file mode 100644
index 426aec5..0000000
--- a/ForgeSVN/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgesvn
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeShortUrl/test.ini
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/test.ini b/ForgeShortUrl/test.ini
deleted file mode 100644
index 0d39a4e..0000000
--- a/ForgeShortUrl/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgeshorturl
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeTracker/test.ini
----------------------------------------------------------------------
diff --git a/ForgeTracker/test.ini b/ForgeTracker/test.ini
deleted file mode 100644
index 0202bfd..0000000
--- a/ForgeTracker/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgetracker
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeUserStats/test.ini
----------------------------------------------------------------------
diff --git a/ForgeUserStats/test.ini b/ForgeUserStats/test.ini
deleted file mode 100644
index 669f24a..0000000
--- a/ForgeUserStats/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgeuserstats
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9768d5/ForgeWiki/test.ini
----------------------------------------------------------------------
diff --git a/ForgeWiki/test.ini b/ForgeWiki/test.ini
deleted file mode 100644
index 5ee4f32..0000000
--- a/ForgeWiki/test.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
-
-[app:main]
-use = config:../Allura/test.ini
-
-[app:main_with_amqp]
-use = config:../Allura/test.ini#main_with_amqp
-
-[loggers]
-keys = root, allura, tool
-
-[handlers]
-keys = test
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = test
-
-[logger_allura]
-level = DEBUG
-handlers =
-qualname = allura
-
-[logger_tool]
-level = DEBUG
-handlers =
-qualname = forgewiki
-
-[handler_test]
-class = FileHandler
-args = ('test.log',)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
-datefmt = %H:%M:%S


[07/17] git commit: [#6388] remove unneeded special nbhd handling for tests

Posted by tv...@apache.org.
[#6388] remove unneeded special nbhd handling for tests

The special config tweaking inspired the creation of patch_middleware_config
but turned out to be all unneeded; tests pass without all this.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8ddd1432
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8ddd1432
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8ddd1432

Branch: refs/heads/master
Commit: 8ddd1432e100aeba4117342286d6405800795378
Parents: 497a734
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Dec 18 20:12:20 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 .../controllers/basetest_neighborhood_root.py   | 191 -------------------
 .../tests/functional/test_neighborhood.py       |  14 +-
 2 files changed, 1 insertion(+), 204 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ddd1432/Allura/allura/controllers/basetest_neighborhood_root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/basetest_neighborhood_root.py b/Allura/allura/controllers/basetest_neighborhood_root.py
deleted file mode 100644
index 6244645..0000000
--- a/Allura/allura/controllers/basetest_neighborhood_root.py
+++ /dev/null
@@ -1,191 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-
-"""Main Controller"""
-import os
-import logging
-from urllib import unquote
-
-import pkg_resources
-from pylons import tmpl_context as c, app_globals as g
-from pylons import request, response
-from webob import exc
-from tg import expose, redirect
-from tg.decorators import without_trailing_slash
-
-import  ming.orm.ormsession
-
-import allura
-from allura.lib.base import WsgiDispatchController
-from allura.lib.security import require, require_authenticated, require_access, has_access
-from allura.lib import helpers as h
-from allura.lib import plugin
-from allura import model as M
-from .root import RootController
-from .project import NeighborhoodController, ProjectController
-from .auth import AuthController
-from .static import NewForgeController
-from .search import SearchController
-from .error import ErrorController
-from .rest import RestController
-
-__all__ = ['RootController']
-
-log = logging.getLogger(__name__)
-
-class BasetestNeighborhoodRootController(WsgiDispatchController, NeighborhoodController):
-    '''Root controller for testing -- it behaves just like a
-    NeighborhoodController for test/ except that all tools are mounted,
-    on-demand, at the mount point that is the same as their entry point
-    name.
-
-    Also, the test-admin is perpetually logged in here.
-
-    The name of this controller is dictated by the override_root setting
-    in development.ini and the magical import rules of TurboGears.  The
-    override_root setting has to match the name of this file, which has
-    to match (less underscores, case changes, and the addition of
-    "Controller") the name of this class.  It will then be registered
-    as the root controller instead of allura.controllers.root.RootController.
-    '''
-
-    def __init__(self):
-        for n in M.Neighborhood.query.find():
-            if n.url_prefix.startswith('//'): continue
-            n.bind_controller(self)
-        proxy_root = RootController()
-        self.dispatch = DispatchTest()
-        self.security = SecurityTests()
-        for attr in ('index', 'browse', 'auth', 'nf', 'error'):
-            setattr(self, attr, getattr(proxy_root, attr))
-        self.gsearch = proxy_root.search
-        self.rest = RestController()
-        p_nbhd = M.Neighborhood.query.get(name='Projects')
-        super(BasetestNeighborhoodRootController, self).__init__(p_nbhd)
-
-    def _setup_request(self):
-        pass
-
-    def _cleanup_request(self):
-        pass
-
-    @expose()
-    def _lookup(self, pname, *remainder):
-        pname = unquote(pname)
-        if not h.re_project_name.match(pname):
-            raise exc.HTTPNotFound, pname
-        project = M.Project.query.get(shortname=self.prefix + pname, neighborhood_id=self.neighborhood._id)
-        if project is None:
-            project = self.neighborhood.neighborhood_project
-            c.project = project
-            return ProjectController()._lookup(pname, *remainder)
-        if project.database_configured == False:
-            if remainder == ('user_icon',):
-                redirect(g.forge_static('images/user.png'))
-            elif c.user.username == pname:
-                log.info('Configuring %s database for access to %r',
-                         pname, remainder)
-                project.configure_project(is_user_project=True)
-            else:
-                raise exc.HTTPNotFound, pname
-        c.project = project
-        if project is None or (project.deleted and not has_access(c.project, 'update')()):
-            raise exc.HTTPNotFound, pname
-        if project.neighborhood.name != self.neighborhood_name:
-            redirect(project.url())
-        return ProjectController(), remainder
-
-    def __call__(self, environ, start_response):
-        c.app = None
-        c.user = plugin.AuthenticationProvider.get(request).by_username(
-            environ.get('username', 'test-admin'))
-        if not c.user:
-            c.user = M.User.anonymous()
-        return WsgiDispatchController.__call__(self, environ, start_response)
-
-class DispatchTest(object):
-
-    @expose()
-    def _lookup(self, *args):
-        if args:
-            return NamedController(args[0]), args[1:]
-        else:
-            raise exc.HTTPNotFound()
-
-class NamedController(object):
-
-    def __init__(self, name):
-        self.name = name
-
-    @expose()
-    def index(self, **kw):
-        return 'index ' + self.name
-
-    @expose()
-    def _default(self, *args):
-        return 'default(%s)(%r)' % (self.name, args)
-
-class SecurityTests(object):
-
-    @expose()
-    def _lookup(self, name, *args):
-        name = unquote(name)
-        if name == '*anonymous':
-            c.user = M.User.anonymous()
-        return SecurityTest(), args
-
-class SecurityTest(object):
-
-    def __init__(self):
-        from forgewiki import model as WM
-        c.app = c.project.app_instance('wiki')
-        self.page = WM.Page.query.get(app_config_id=c.app.config._id, title='Home')
-
-    @expose()
-    def forbidden(self):
-        require(lambda:False, 'Never allowed')
-        return ''
-
-    @expose()
-    def needs_auth(self):
-        require_authenticated()
-        return ''
-
-    @expose()
-    def needs_project_access_fail(self):
-        require_access(c.project, 'no_such_permission')
-        return ''
-
-    @expose()
-    def needs_project_access_ok(self):
-        pred = has_access(c.project, 'read')
-        if not pred():
-            log.info('Inside needs_project_access, c.user = %s' % c.user)
-        require(pred)
-        return ''
-
-    @expose()
-    def needs_artifact_access_fail(self):
-        require_access(self.page, 'no_such_permission')
-        return ''
-
-    @expose()
-    def needs_artifact_access_ok(self):
-        require_access(self.page, 'read')
-        return ''

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ddd1432/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 2b165a3..7fe3916 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -32,20 +32,8 @@ from allura.tests import TestController
 from allura.tests import decorators as td
 from allura.lib import helpers as h
 
-class TestNeighborhood(TestController):
 
-    def setUp(self):
-        # change the override_root config value to change which root controller the test uses
-        self._make_app = allura.config.middleware.make_app
-        def make_app(global_conf, full_stack=True, **app_conf):
-            app_conf['override_root'] = 'basetest_neighborhood_root'
-            return self._make_app(global_conf, full_stack, **app_conf)
-        allura.config.middleware.make_app = make_app
-        super(TestNeighborhood, self).setUp()
-
-    def tearDown(self):
-        super(TestNeighborhood, self).tearDown()
-        allura.config.middleware.make_app = self._make_app
+class TestNeighborhood(TestController):
 
     def test_home_project(self):
         r = self.app.get('/adobe/wiki/')


[10/17] git commit: [#6388] add args, write to csv

Posted by tv...@apache.org.
[#6388] add args, write to csv


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1cff564a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1cff564a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1cff564a

Branch: refs/heads/master
Commit: 1cff564a94b62d093ca1347ee5d7a17b1678b5d6
Parents: dccd000
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 20 17:15:47 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 scripts/perf/call_count.py | 54 +++++++++++++++++++++++++++++++++++------
 1 file changed, 46 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1cff564a/scripts/perf/call_count.py
----------------------------------------------------------------------
diff --git a/scripts/perf/call_count.py b/scripts/perf/call_count.py
index 718f5b0..0c93705 100755
--- a/scripts/perf/call_count.py
+++ b/scripts/perf/call_count.py
@@ -17,10 +17,12 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
+import argparse
 import json
 import logging
 import random
 import string
+import csv
 
 from pylons import tmpl_context as c
 from testfixtures import LogCapture
@@ -36,12 +38,32 @@ from allura.tests.decorators import patch_middleware_config
 from forgewiki import model as WM
 
 
-def main():
+def parse_args():
+    parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
+                                     description='Count number of expensive calls (mongo, markdown, etc) for a standard page.')
+    parser.add_argument('--verbose', '-v', action='store_true', default=False,
+                        help='Show call details')
+    parser.add_argument('--debug-html', action='store_true', default=False,
+                        help='Save HTML responses as local files')
+    parser.add_argument('--data-file', default='call_counts.csv', type=argparse.FileType('a'),
+                        help='CSV file that is appended to')
+    parser.add_argument('--id', default='',
+                        help='An identifier for this run.  Examples:\n'
+                             '`git rev-parse --short HEAD` for current hash\n'
+                             '`git log -1 --oneline` for hash + message')
+    return parser.parse_args()
+
+
+def main(args):
     test = TestController()
     setup(test)
+
     url = generate_wiki_thread(test)
     ThreadLocalODMSession.close_all()  # make sure ODM sessions won't get re-used
-    load_page(test, url)
+
+    counts = count_page(test, url, verbose=args.verbose, debug_html=args.debug_html)
+    print json.dumps(counts)
+    write_csv(counts, args.id, args.data_file)
     test.tearDown()
 
 
@@ -67,7 +89,7 @@ def generate_wiki_thread(test):
 
     page = WM.Page.query.get(app_config_id=app.config._id, title='Home')
     thread = page.discussion_thread
-    # create 3 posts by 2 users
+    # create a few posts by a few users
     with push_config(c, user=M.User.query.get(username='test-admin'),
                         app=app,
                         project=project):
@@ -75,6 +97,8 @@ def generate_wiki_thread(test):
         thread.add_post(text="But it's not **super** helpful")
         with push_config(c, user=M.User.query.get(username='test-user')):
             thread.add_post(text='I disagree')
+        with push_config(c, user=M.User.query.get(username='test-user-1')):
+            thread.add_post(text='But what about foo?')
 
     ThreadLocalODMSession.flush_all()
 
@@ -82,7 +106,7 @@ def generate_wiki_thread(test):
     return url
 
 
-def load_page(test, url, verbose=False, debug_html=False):
+def count_page(test, url, verbose=False, debug_html=False):
 
     with LogCapture('stats') as stats, LogCapture('timermiddleware') as calls:
         resp = test.app.get(url, extra_environ=dict(username='*anonymous'))
@@ -97,10 +121,24 @@ def load_page(test, url, verbose=False, debug_html=False):
         for r in calls.records:
             print r.getMessage()
 
-    for r in stats.records:
-        timings = json.loads(r.getMessage())
-        print json.dumps(timings['call_counts'])
+    assert len(stats.records) == 1
+    timings = json.loads(stats.records[0].getMessage())
+    del timings['call_counts']['total']  # total is always 1, which is misleading
+    return timings['call_counts']
+
+
+def write_csv(counts, id, data_file):
+    cols = sorted(counts.keys())
+    row = counts
+    if id:
+        cols = ['id'] + cols
+        row = dict(counts, id=id)
+    csv_out = csv.DictWriter(data_file, cols)
+    if data_file.tell() == 0:
+        csv_out.writeheader()
+    csv_out.writerow(row)
+    data_file.close()
 
 
 if __name__ == '__main__':
-    main()
+    main(parse_args())


[09/17] git commit: [#6388] don't do verbose logging on cursor.next

Posted by tv...@apache.org.
[#6388] don't do verbose logging on cursor.next


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ec1e8d06
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ec1e8d06
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ec1e8d06

Branch: refs/heads/master
Commit: ec1e8d06c1e1bcb08c8e7c98ac76f4e4aa870100
Parents: 1cff564
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Dec 19 17:11:52 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/custom_middleware.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ec1e8d06/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index e5fef4f..498a614 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -192,7 +192,8 @@ class AlluraTimerMiddleware(TimerMiddleware):
         return self.entry_point_timers() + [
             Timer('jinja', jinja2.Template, 'render', 'stream', 'generate'),
             Timer('markdown', markdown.Markdown, 'convert'),
-            Timer('ming', ming.odm.odmsession.ODMCursor, 'next'),  # FIXME: this may captures timings ok, but is misleading for counts
+            Timer('ming', ming.odm.odmsession.ODMCursor, 'next',  # FIXME: this may captures timings ok, but is misleading for counts
+                  debug_each_call=False),
             Timer('ming', ming.odm.odmsession.ODMSession, 'flush', 'find',
                 'get'),
             Timer('ming', ming.schema.Document, 'validate',


[06/17] git commit: [#6388] don't query for a post parent if its None

Posted by tv...@apache.org.
[#6388] don't query for a post parent if its None


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a7ab2f3c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a7ab2f3c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a7ab2f3c

Branch: refs/heads/master
Commit: a7ab2f3c40a46abde24403b6896ca364b3b4925e
Parents: b97e47f
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Dec 19 17:44:13 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/discuss.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a7ab2f3c/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 1059295..efa7b35 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -531,7 +531,8 @@ class Post(Message, VersionedArtifact, ActivityObject):
 
     @property
     def parent(self):
-        return self.query.get(_id=self.parent_id)
+        if self.parent_id:
+            return self.query.get(_id=self.parent_id)
 
     @property
     def subject(self):


[05/17] git commit: [#6388] avoid 1 mongo query in test controller setup

Posted by tv...@apache.org.
[#6388] avoid 1 mongo query in test controller setup


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/78c03646
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/78c03646
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/78c03646

Branch: refs/heads/master
Commit: 78c036468c2f803075af82872f5410fca49ee7f5
Parents: a7ab2f3
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Dec 19 18:30:41 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/basetest_project_root.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/78c03646/Allura/allura/controllers/basetest_project_root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/basetest_project_root.py b/Allura/allura/controllers/basetest_project_root.py
index b73a851..ceb597b 100644
--- a/Allura/allura/controllers/basetest_project_root.py
+++ b/Allura/allura/controllers/basetest_project_root.py
@@ -67,9 +67,12 @@ class BasetestProjectRootController(WsgiDispatchController, ProjectController):
 
     def __init__(self):
         for n in M.Neighborhood.query.find():
-            if n.url_prefix.startswith('//'): continue
+            if n.url_prefix.startswith('//'):
+                continue
             n.bind_controller(self)
-        self.p_nbhd = M.Neighborhood.query.get(name='Projects')
+            if n.url_prefix == '/p/':
+                self.p_nbhd = n
+
         proxy_root = RootController()
         self.dispatch = DispatchTest()
         self.security = SecurityTests()


[08/17] git commit: [#6388] simple call count script

Posted by tv...@apache.org.
[#6388] simple call count script


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/497a7347
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/497a7347
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/497a7347

Branch: refs/heads/master
Commit: 497a734704e692b02479a885390ddd2a4b0e3c53
Parents: 0f9768d
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Dec 17 21:27:56 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 Allura/allura/tests/decorators.py | 26 +++++++++++
 scripts/perf/call_count.py        | 80 ++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/497a7347/Allura/allura/tests/decorators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/decorators.py b/Allura/allura/tests/decorators.py
index dd9fdf1..3e1c43d 100644
--- a/Allura/allura/tests/decorators.py
+++ b/Allura/allura/tests/decorators.py
@@ -26,6 +26,7 @@ import tg
 from paste.deploy.converters import asbool
 
 from allura import model as M
+import allura.config.middleware
 
 
 def with_user_project(username):
@@ -120,3 +121,28 @@ def without_module(*module_names):
                 return func(*a, **kw)
         return wrapped
     return _without_module
+
+
+class patch_middleware_config(object):
+    '''
+    Context manager that patches the configuration used during middleware
+    setup for Allura
+    '''
+
+    def __init__(self, new_configs):
+        self.new_configs = new_configs
+
+    def __enter__(self):
+        self._make_app = allura.config.middleware.make_app
+
+        def make_app(global_conf, full_stack=True, **app_conf):
+            app_conf.update(self.new_configs)
+            return self._make_app(global_conf, full_stack, **app_conf)
+
+        allura.config.middleware.make_app = make_app
+
+        return self
+
+    def __exit__(self, exc_type, exc_val, exc_t):
+        allura.config.middleware.make_app = self._make_app
+        return self

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/497a7347/scripts/perf/call_count.py
----------------------------------------------------------------------
diff --git a/scripts/perf/call_count.py b/scripts/perf/call_count.py
new file mode 100755
index 0000000..2b8e15c
--- /dev/null
+++ b/scripts/perf/call_count.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+import json
+from pprint import pprint
+
+from pylons import tmpl_context as c
+from testfixtures import LogCapture
+
+from allura import model as M
+from allura.lib.helpers import push_config
+from allura.tests import TestController
+from allura.tests.decorators import patch_middleware_config
+
+from forgewiki import model as WM
+
+
+def main():
+    test = TestController()
+    setup(test)
+    url = generate_wiki_thread(test)
+    load_page(test, url)
+    load_page(test, url)
+    load_page(test, url)
+    test.tearDown()
+
+
+def setup(test):
+    # includes setting up mim
+    with patch_middleware_config({'stats.sample_rate': 1}):
+       test.setUp()
+
+
+def generate_wiki_thread(test):
+    # automagically instantiate the app
+    test.app.get('/wiki/')
+
+    project = M.Project.query.get(shortname='test')
+    app = project.app_instance('wiki')
+
+    page = WM.Page.query.get(app_config_id=app.config._id, title='Home')
+    thread = page.discussion_thread
+    # create 3 posts by 2 users
+    with push_config(c, user=M.User.query.get(username='test-admin'),
+                        app=app,
+                        project=project):
+        thread.add_post(text='This is very helpful')
+        thread.add_post(text="But it's not **super** helpful")
+        with push_config(c, user=M.User.query.get(username='test-user')):
+            thread.add_post(text='I disagree')
+
+    url = '/p/test/wiki/_discuss/thread/{}/'.format(thread._id)
+    return url
+
+
+def load_page(test, url):
+    with LogCapture('stats') as l:
+        print url, test.app.get(url, extra_environ=dict(username='*anonymous')).status
+    for r in l.records:
+        timings = json.loads(r.message)
+        print json.dumps(timings['call_counts'])
+
+if __name__ == '__main__':
+    main()


[02/17] git commit: [#6388] remove unused main_without_authn (was part of TG quickstart)

Posted by tv...@apache.org.
[#6388] remove unused main_without_authn (was part of TG quickstart)


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/aa723802
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/aa723802
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/aa723802

Branch: refs/heads/master
Commit: aa7238028f1046ef0be24e98052e1d291c3f4569
Parents: 676e09e
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Dec 17 18:47:15 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:19 2014 +0000

----------------------------------------------------------------------
 Allura/allura/tests/__init__.py     | 2 --
 Allura/test.ini                     | 4 ----
 AlluraTest/alluratest/controller.py | 2 +-
 ForgeActivity/test.ini              | 3 ---
 ForgeBlog/test.ini                  | 3 ---
 ForgeChat/test.ini                  | 3 ---
 ForgeDiscussion/test.ini            | 3 ---
 ForgeGit/test.ini                   | 3 ---
 ForgeImporters/test.ini             | 3 ---
 ForgeLink/test.ini                  | 3 ---
 ForgeSVN/test.ini                   | 3 ---
 ForgeShortUrl/test.ini              | 3 ---
 ForgeTracker/test.ini               | 3 ---
 ForgeUserStats/test.ini             | 3 ---
 ForgeWiki/test.ini                  | 3 ---
 15 files changed, 1 insertion(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/Allura/allura/tests/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/__init__.py b/Allura/allura/tests/__init__.py
index d96e4ad..3fb7e93 100644
--- a/Allura/allura/tests/__init__.py
+++ b/Allura/allura/tests/__init__.py
@@ -27,5 +27,3 @@ class TestController(alluratest.controller.TestController):
     Base functional test case for the controllers.
 
     """
-
-    application_under_test = 'main_without_authn'

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/Allura/test.ini
----------------------------------------------------------------------
diff --git a/Allura/test.ini b/Allura/test.ini
index 5df127f..5ae2aef 100644
--- a/Allura/test.ini
+++ b/Allura/test.ini
@@ -123,10 +123,6 @@ markdown_render_max_length = 40000
 user_message.time_interval = 3600
 user_message.max_messages = 200
 
-[app:main_without_authn]
-use = main
-skip_authentication = True
-
 [app:main_with_amqp]
 use = main
 # Use test RabbitMQ vhost

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index e382a64..4c3c4e5 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -42,7 +42,7 @@ from allura.websetup.schema import REGISTRY
 #from allura.lib.custom_middleware import environ as ENV, MagicalC
 from .validation import ValidatingTestApp
 
-DFL_APP_NAME = 'main_without_authn'
+DFL_APP_NAME = 'main'
 
 # these are all helpers & base classes, and should never
 # be considered test cases when imported into some test module

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeActivity/test.ini
----------------------------------------------------------------------
diff --git a/ForgeActivity/test.ini b/ForgeActivity/test.ini
index 1cbd5c6..b522f20 100644
--- a/ForgeActivity/test.ini
+++ b/ForgeActivity/test.ini
@@ -32,9 +32,6 @@ use = config:../Allura/test.ini
 
 activitystream.recording.enabled = true
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeBlog/test.ini
----------------------------------------------------------------------
diff --git a/ForgeBlog/test.ini b/ForgeBlog/test.ini
index c8907df..e29c4a3 100644
--- a/ForgeBlog/test.ini
+++ b/ForgeBlog/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeChat/test.ini
----------------------------------------------------------------------
diff --git a/ForgeChat/test.ini b/ForgeChat/test.ini
index 6477871..55b5d76 100644
--- a/ForgeChat/test.ini
+++ b/ForgeChat/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeDiscussion/test.ini
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/test.ini b/ForgeDiscussion/test.ini
index 95748cc..1d2afd7 100644
--- a/ForgeDiscussion/test.ini
+++ b/ForgeDiscussion/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeGit/test.ini
----------------------------------------------------------------------
diff --git a/ForgeGit/test.ini b/ForgeGit/test.ini
index 58374c9..fa59b5b 100644
--- a/ForgeGit/test.ini
+++ b/ForgeGit/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeImporters/test.ini
----------------------------------------------------------------------
diff --git a/ForgeImporters/test.ini b/ForgeImporters/test.ini
index 019c262..0d39a4e 100644
--- a/ForgeImporters/test.ini
+++ b/ForgeImporters/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeLink/test.ini
----------------------------------------------------------------------
diff --git a/ForgeLink/test.ini b/ForgeLink/test.ini
index b3279c7..5b959b0 100644
--- a/ForgeLink/test.ini
+++ b/ForgeLink/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeSVN/test.ini
----------------------------------------------------------------------
diff --git a/ForgeSVN/test.ini b/ForgeSVN/test.ini
index 4c2e596..426aec5 100644
--- a/ForgeSVN/test.ini
+++ b/ForgeSVN/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeShortUrl/test.ini
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/test.ini b/ForgeShortUrl/test.ini
index 019c262..0d39a4e 100644
--- a/ForgeShortUrl/test.ini
+++ b/ForgeShortUrl/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeTracker/test.ini
----------------------------------------------------------------------
diff --git a/ForgeTracker/test.ini b/ForgeTracker/test.ini
index 23d52ed..0202bfd 100644
--- a/ForgeTracker/test.ini
+++ b/ForgeTracker/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeUserStats/test.ini
----------------------------------------------------------------------
diff --git a/ForgeUserStats/test.ini b/ForgeUserStats/test.ini
index 51160bb..669f24a 100644
--- a/ForgeUserStats/test.ini
+++ b/ForgeUserStats/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa723802/ForgeWiki/test.ini
----------------------------------------------------------------------
diff --git a/ForgeWiki/test.ini b/ForgeWiki/test.ini
index 841b55e..5ee4f32 100644
--- a/ForgeWiki/test.ini
+++ b/ForgeWiki/test.ini
@@ -30,9 +30,6 @@ port = 5000
 [app:main]
 use = config:../Allura/test.ini
 
-[app:main_without_authn]
-use = config:../Allura/test.ini#main_without_authn
-
 [app:main_with_amqp]
 use = config:../Allura/test.ini#main_with_amqp
 


[17/17] git commit: [#6388] avoid empty trove queries

Posted by tv...@apache.org.
[#6388] avoid empty trove queries


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/35ed1c39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/35ed1c39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/35ed1c39

Branch: refs/heads/master
Commit: 35ed1c39ed49f9225071263db578e1562c292a2d
Parents: 15225cd
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 20 19:03:12 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:21 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/project.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/35ed1c39/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index d8584ef..b720343 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -257,7 +257,11 @@ class Project(MappedClass, ActivityNode, ActivityObject):
         return result
 
     def troves_by_type(self, trove_type):
-        return TroveCategory.query.find({'_id':{'$in':getattr(self,'trove_%s' % trove_type)}}).all()
+        troves = getattr(self, 'trove_%s' % trove_type)
+        if troves:
+            return TroveCategory.query.find({'_id':{'$in': troves}}).all()
+        else:
+            return []
 
     def all_troves(self):
         '''


[12/17] git commit: [#6388] don't instrument ming session.get

Posted by tv...@apache.org.
[#6388] don't instrument ming session.get

It is often a no-op, if the object is already in the identity map.  And
when it's not in the identity map and a mongo query does happen, its
covered by session.find instrumentation


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b97e47f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b97e47f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b97e47f2

Branch: refs/heads/master
Commit: b97e47f27f54b3def8bddfd1a434b6f2c06fc841
Parents: ec1e8d0
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Dec 19 17:12:27 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/custom_middleware.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b97e47f2/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 498a614..d7cbdc9 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -194,8 +194,7 @@ class AlluraTimerMiddleware(TimerMiddleware):
             Timer('markdown', markdown.Markdown, 'convert'),
             Timer('ming', ming.odm.odmsession.ODMCursor, 'next',  # FIXME: this may captures timings ok, but is misleading for counts
                   debug_each_call=False),
-            Timer('ming', ming.odm.odmsession.ODMSession, 'flush', 'find',
-                'get'),
+            Timer('ming', ming.odm.odmsession.ODMSession, 'flush', 'find'),
             Timer('ming', ming.schema.Document, 'validate',
                 debug_each_call=False),
             Timer('ming', ming.schema.FancySchemaItem, '_validate_required',


[11/17] git commit: [#6388] start capturing verbose logging in perf script

Posted by tv...@apache.org.
[#6388] start capturing verbose logging in perf script


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/dccd0006
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/dccd0006
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/dccd0006

Branch: refs/heads/master
Commit: dccd000647ce8128053bbb4be5020fdb78051eff
Parents: 8ddd143
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Dec 18 22:39:51 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:20 2014 +0000

----------------------------------------------------------------------
 scripts/perf/call_count.py | 46 ++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dccd0006/scripts/perf/call_count.py
----------------------------------------------------------------------
diff --git a/scripts/perf/call_count.py b/scripts/perf/call_count.py
index 2b8e15c..718f5b0 100755
--- a/scripts/perf/call_count.py
+++ b/scripts/perf/call_count.py
@@ -18,10 +18,15 @@
 #       under the License.
 
 import json
-from pprint import pprint
+import logging
+import random
+import string
 
 from pylons import tmpl_context as c
 from testfixtures import LogCapture
+from mock import patch
+import timermiddleware
+from ming.odm import ThreadLocalODMSession
 
 from allura import model as M
 from allura.lib.helpers import push_config
@@ -35,16 +40,22 @@ def main():
     test = TestController()
     setup(test)
     url = generate_wiki_thread(test)
-    load_page(test, url)
-    load_page(test, url)
+    ThreadLocalODMSession.close_all()  # make sure ODM sessions won't get re-used
     load_page(test, url)
     test.tearDown()
 
 
 def setup(test):
     # includes setting up mim
-    with patch_middleware_config({'stats.sample_rate': 1}):
-       test.setUp()
+    with patch_middleware_config({'stats.sample_rate': 1,
+                                  'stats.debug_line_length': 1000,
+                                  }), \
+         patch('timermiddleware.log.isEnabledFor', return_value=True):  # can't set this via logging configuration since setUp() will load a logging config and then start using it before we have a good place to tweak it
+        test.setUp()
+
+    tmw_log = logging.getLogger('timermiddleware')
+    tmw_log.disabled = 0  # gets disabled when .ini file is loaded; dumb.
+    tmw_log.setLevel(logging.DEBUG)
 
 
 def generate_wiki_thread(test):
@@ -65,16 +76,31 @@ def generate_wiki_thread(test):
         with push_config(c, user=M.User.query.get(username='test-user')):
             thread.add_post(text='I disagree')
 
+    ThreadLocalODMSession.flush_all()
+
     url = '/p/test/wiki/_discuss/thread/{}/'.format(thread._id)
     return url
 
 
-def load_page(test, url):
-    with LogCapture('stats') as l:
-        print url, test.app.get(url, extra_environ=dict(username='*anonymous')).status
-    for r in l.records:
-        timings = json.loads(r.message)
+def load_page(test, url, verbose=False, debug_html=False):
+
+    with LogCapture('stats') as stats, LogCapture('timermiddleware') as calls:
+        resp = test.app.get(url, extra_environ=dict(username='*anonymous'))
+        print url, resp.status
+        if debug_html:
+            debug_filename = 'call-{}.html'.format(''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)]))
+            with open(debug_filename, 'w') as out:
+                out.write(resp.body)
+            print debug_filename
+
+    if verbose:
+        for r in calls.records:
+            print r.getMessage()
+
+    for r in stats.records:
+        timings = json.loads(r.getMessage())
         print json.dumps(timings['call_counts'])
 
+
 if __name__ == '__main__':
     main()


[14/17] git commit: [#6388] more help text

Posted by tv...@apache.org.
[#6388] more help text


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cdb91d5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cdb91d5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cdb91d5f

Branch: refs/heads/master
Commit: cdb91d5fc62b16c78eea6fd5993b901663035c32
Parents: 35ed1c3
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 20 19:14:16 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:21 2014 +0000

----------------------------------------------------------------------
 scripts/perf/call_count.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cdb91d5f/scripts/perf/call_count.py
----------------------------------------------------------------------
diff --git a/scripts/perf/call_count.py b/scripts/perf/call_count.py
index 0c93705..f965294 100755
--- a/scripts/perf/call_count.py
+++ b/scripts/perf/call_count.py
@@ -39,10 +39,14 @@ from forgewiki import model as WM
 
 
 def parse_args():
-    parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
-                                     description='Count number of expensive calls (mongo, markdown, etc) for a standard page.')
+    parser = argparse.ArgumentParser(
+        formatter_class=argparse.RawTextHelpFormatter,
+        description='Count number of expensive calls (mongo, markdown, etc) for a standard page.\n'
+                    'Currently its a _discuss URL with a few posts on it.  This exercises core logic\n'
+                    '(project & tool lookup, security, discussion thread, main template, etc) but\n'
+                    'intentionally avoids most tool-specific code.')
     parser.add_argument('--verbose', '-v', action='store_true', default=False,
-                        help='Show call details')
+                        help='Show call details.  Note that Timers with debug_each_call=False (like ming\'s Cursor.next) are not displayed in verbose mode (but they are counted).')
     parser.add_argument('--debug-html', action='store_true', default=False,
                         help='Save HTML responses as local files')
     parser.add_argument('--data-file', default='call_counts.csv', type=argparse.FileType('a'),


[13/17] git commit: [#6388] fix capitalization in module lookup

Posted by tv...@apache.org.
[#6388] fix capitalization in module lookup


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1bb460c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1bb460c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1bb460c6

Branch: refs/heads/master
Commit: 1bb460c6e7e4329ee0c698f04b28758231136d7b
Parents: 84d6afc
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Jan 2 15:50:57 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:21 2014 +0000

----------------------------------------------------------------------
 AlluraTest/alluratest/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1bb460c6/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index 62cc03c..0017c48 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -57,7 +57,7 @@ def get_config_file(config=None):
     try:
         conf_dir = tg.config.here
     except AttributeError:
-        conf_dir = pkg_resources.resource_filename('Allura', '..')
+        conf_dir = pkg_resources.resource_filename('allura', '..')
     return os.path.join(conf_dir, config)
 
 


[16/17] git commit: [#6388] remove unnecessary wiki page lookup from sidebar (last needed in baa85e8)

Posted by tv...@apache.org.
[#6388] remove unnecessary wiki page lookup from sidebar (last needed in baa85e8)


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/84d6afcc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/84d6afcc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/84d6afcc

Branch: refs/heads/master
Commit: 84d6afcc2991000dd9369d7d02ac7b7ef688aa5c
Parents: cdb91d5
Author: Dave Brondsema <da...@brondsema.net>
Authored: Fri Dec 20 14:22:32 2013 -0500
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:21 2014 +0000

----------------------------------------------------------------------
 ForgeWiki/forgewiki/wiki_main.py | 6 ------
 1 file changed, 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/84d6afcc/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 55ee9a3..e2112b6 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -228,12 +228,6 @@ class ForgeWikiApp(Application):
 
     @h.exceptionless([], log)
     def sidebar_menu(self):
-        try:
-            page = request.path_info.split(self.url)[-1].split('/')[-2]
-            page = h.really_unicode(page)
-            page = WM.Page.query.find(dict(app_config_id=self.config._id, title=page, deleted=False)).first()
-        except:
-            page = None
         return self.create_common_wiki_menu(has_access(self, 'create'),c.app.url,'add_wiki_page')
 
     def install(self, project):


[04/17] git commit: [#6388] separate out timermiddleware logging into stats.log

Posted by tv...@apache.org.
[#6388] separate out timermiddleware logging into stats.log


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/c9f595a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/c9f595a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/c9f595a6

Branch: refs/heads/master
Commit: c9f595a6c6743032e25cd1194eb1f2214bcff963
Parents: 7337947
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Dec 17 17:43:57 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:19 2014 +0000

----------------------------------------------------------------------
 Allura/development.ini | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c9f595a6/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index b9df222..930bbb8 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -333,13 +333,13 @@ override_root = task
 # http://docs.python.org/lib/logging-config-fileformat.html
 
 [loggers]
-keys = root, allura, sqlalchemy, paste, amqp, pylons, taskdstatus
+keys = root, allura, sqlalchemy, paste, amqp, pylons, taskdstatus, timermiddleware
 
 [handlers]
-keys = console, stats, taskdstatus
+keys = console, stats, taskdstatus, timermiddleware
 
 [formatters]
-keys = generic, stats
+keys = generic, stats, timermiddleware
 
 # If you create additional loggers, add them as a key to [loggers]
 [logger_root]
@@ -379,6 +379,12 @@ level = INFO
 qualname = taskdstatus
 handlers = taskdstatus
 
+[logger_timermiddleware]
+level = INFO
+handlers = timermiddleware
+qualname = stats
+propagate = 0
+
 # If you create additional handlers, add them as a key to [handlers]
 [handler_console]
 class = StreamHandler
@@ -398,6 +404,14 @@ args = ('taskd_status.log', 'a')
 level = NOTSET
 formatter = generic
 
+[handler_timermiddleware]
+class = handlers.WatchedFileHandler
+# if you run 'paster serve' in allura/Allura/ then that's where this file will be
+# you may want to hard-code a specific directory here.
+args = ('stats.log', 'a')
+level = NOTSET
+formatter = timermiddleware
+
 # If you create additional formatters, add them as a key to [formatters]
 [formatter_generic]
 format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
@@ -406,3 +420,7 @@ datefmt = %H:%M:%S
 [formatter_stats]
 format = %(asctime)s %(created)d %(kwpairs)s
 datefmt = %d/%b/%Y:%H:%M:%S UTC
+
+[formatter_timermiddleware]
+format = {"time": "%(asctime)s,%(msecs)03d", "level": "%(levelname)-5.5s", "name": "%(name)s", "message": %(message)s}
+datefmt = %Y-%m-%d %H:%M:%S
\ No newline at end of file


[03/17] git commit: [#6388] add logging stub for Timermiddleware verbose logging

Posted by tv...@apache.org.
[#6388] add logging stub for Timermiddleware verbose logging


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/676e09ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/676e09ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/676e09ee

Branch: refs/heads/master
Commit: 676e09eea39a5ec774a5dd65a544f10da5e59863
Parents: c9f595a
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Dec 17 17:53:56 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:19 2014 +0000

----------------------------------------------------------------------
 Allura/development.ini | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/676e09ee/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 930bbb8..5a3d83f 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -333,7 +333,7 @@ override_root = task
 # http://docs.python.org/lib/logging-config-fileformat.html
 
 [loggers]
-keys = root, allura, sqlalchemy, paste, amqp, pylons, taskdstatus, timermiddleware
+keys = root, allura, sqlalchemy, paste, amqp, pylons, taskdstatus, timermiddleware, tmw_details
 
 [handlers]
 keys = console, stats, taskdstatus, timermiddleware
@@ -374,6 +374,12 @@ level = INFO
 qualname = pylons
 handlers =
 
+[logger_tmw_details]
+# DEBUG will include every instrumented call in our logging
+level = INFO
+qualname = timermiddleware
+handlers =
+
 [logger_taskdstatus]
 level = INFO
 qualname = taskdstatus


[15/17] git commit: [#6388] wrapper script to run call_counts.py for a range of git commits

Posted by tv...@apache.org.
[#6388] wrapper script to run call_counts.py for a range of git commits


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/15225cd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/15225cd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/15225cd8

Branch: refs/heads/master
Commit: 15225cd831b0baa70ee11256061fc4dda7773780
Parents: 78c0364
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 20 19:02:51 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:21 2014 +0000

----------------------------------------------------------------------
 scripts/perf/call_count_walk_git.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/15225cd8/scripts/perf/call_count_walk_git.sh
----------------------------------------------------------------------
diff --git a/scripts/perf/call_count_walk_git.sh b/scripts/perf/call_count_walk_git.sh
new file mode 100755
index 0000000..8bb41ba
--- /dev/null
+++ b/scripts/perf/call_count_walk_git.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [[ $@ ]]
+then
+    revs=$@
+else
+    revs='HEAD -n 10'
+    echo "No git revision range given, using $revs"
+    echo "Other range formats like bdde98d..HEAD work too"
+    echo
+fi
+
+current=`git rev-parse --abbrev-ref HEAD`
+git rev-list --reverse $revs --oneline | while read commit
+do
+    echo $commit
+    sha=${commit:0:7}
+    git checkout -q $sha || { echo "Could not check out $sha, stopping.  You started on $current"; break; }
+    ./call_count.py --id "$commit"
+done
+git checkout -q $current
\ No newline at end of file