Beispiel #1
0
def step_part_detail(request, step, detail_name):
    db = get_database_connection()
    step = db.steps.find_one({"_id" : ObjectId(str(step))})
    if not step or detail_name not in step:
        return HttpResponseNotFound()
    
    return HttpResponse(step[detail_name])
 def get_status(self):
     db = get_database_connection()
     builder = db.builders.find_one({'name' : self.get_identifier(), 'master_id' : self.project.get_buildmaster().pk})
     if not builder or 'status' not in builder:
         return 'no builder / no result yet'
     else:
         return builder['status']
    def get_last_build_status(self):
        db = get_database_connection()
        try:
            build = Build(db.builds.find({'builder' : self.get_identifier(), 'time_end' : {'$ne' : None}}).sort([("time_end", -1)]).limit(1).next())
        except StopIteration:
            return BUILD_RESULTS_DICT["no-result"]

        return build.get_text_result()
Beispiel #4
0
    def get_status_from_database(self):
        db = get_database_connection()
        builder = db.builders.find_one({'name' : self.get_identifier(), 'master_id' : self.project.get_buildmaster().pk})
        if not builder:
            return ClientOffline()
        else:
            BUILDBOT_CLIENT_STATUS_MAP = {
                'offline' : ClientOffline,
                'building' : ClientRunning,
                'idle' : ClientReady
            }

            if builder['status'] not in BUILDBOT_CLIENT_STATUS_MAP:
                raise ValueError("Received unexpected BuildBot status %s" % builder['status'])

            return BUILDBOT_CLIENT_STATUS_MAP[builder['status']]()
Beispiel #5
0
def project_changeset_view(request, project):
    project = get_object_or_404(Project, slug=project)

    db = get_database_connection()

    info = db.repository.find().sort([("commiter_date", DESCENDING),])

    changesets = []

    for changeset in info:
        changeset['results'] = [build['result'] for build in db.builds.find({"changeset" : changeset['hash']})]
        changesets.append(changeset)

    return direct_to_template(request, 'cthulhubot/project_changeset_view.html', {
        'project' : project,
        'changesets' : changesets,
    })
    def setUp(self):
        super(TestResults, self).setUp()
        self._mock_resolver()
        self.db = get_database_connection()

        self.project_name = u"project"
        self.project = Project(name=self.project_name, tracker_uri="http://example.com", repository_uri="/tmp/project")
        self.buildmaster = Buildmaster(project=self.project, buildmaster_port=0, webstatus_port=1)

        self.computer = BuildComputer(hostname="localhost")

        self.job = Job(slug='cthulhubot-sleep').get_domain_object()

        self.assignment = JobAssignment(
            job = self.job.model,
            project = self.project,
            computer = self.computer,
        ).get_domain_object()

        self.client = ProjectClient(project=self.project, computer=self.computer)
Beispiel #7
0
 def _drop_database(self):
     from cthulhubot.mongo import get_database_connection
     db = get_database_connection()
     conn = db.connection
     conn.drop_database(db)
 def setUp(self):
     super(ParticularCommandTestCase, self).setUp()
     self.db = get_database_connection()
     mock_url_root(self)
     prepare_working_assignment(self)
 def setUp(self):
     super(TestTemplateTag, self).setUp()
     self.db = get_database_connection()
     self.build = self.insert_build()
 def get_builds(self):
     db = get_database_connection()
     return [build for build in db.builds.find({"builder" : self.get_identifier()}).sort([("number", -1)])]