コード例 #1
0
    def setUp(self):
        plugins_dir = os.getenv("PLUGINS_DIR", "/etc/snap/plugins")
        snapteld_dir = os.getenv("SNAPTELD_DIR", "/usr/local/sbin")
        snaptel_dir = os.getenv("SNAPTEL_DIR", "/usr/local/bin")

        snapteld_url = "http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snapteld"
        snaptel_url = "http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snaptel"
        meminfo_url = "http://snap.ci.snap-telemetry.io/plugins/snap-plugin-collector-meminfo/latest_build/linux/x86_64/snap-plugin-collector-meminfo"
        mockfile_url = "http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snap-plugin-publisher-mock-file"

        # set and download required binaries (snapteld, snaptel, plugins)
        self.binaries = bins.Binaries()
        self.binaries.snapteld = bins.Snapteld(snapteld_url, snapteld_dir)
        self.binaries.snaptel = bins.Snaptel(snaptel_url, snaptel_dir)
        self.binaries.collector = bins.Plugin(meminfo_url, plugins_dir,
                                              "collector", 3)
        self.binaries.publisher = bins.Plugin(mockfile_url, plugins_dir,
                                              "publisher", -1)

        utils.download_binaries(self.binaries)

        self.task_file = "{}/examples/tasks/task-mem.json".format(
            os.getenv("PROJECT_DIR", "snap-plugin-collector-meminfo"))

        log.info("starting snapteld")
        self.binaries.snapteld.start()
        if not self.binaries.snapteld.isAlive():
            self.fail("snapteld thread died")

        log.debug("Waiting for snapteld to finish starting")
        if not self.binaries.snapteld.wait():
            log.error("snapteld errors: {}".format(
                self.binaries.snapteld.errors))
            self.binaries.snapteld.kill()
            self.fail("snapteld not ready, timeout!")
コード例 #2
0
    def setUp(self):
        plugins_dir = os.getenv("PLUGINS_DIR", "/etc/snap/plugins")
        snap_dir = os.getenv("SNAP_DIR", "/usr/local/bin")

        snapteld_url = "http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snapteld"
        snaptel_url = "http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snaptel"
        psutil_url = "http://snap.ci.snap-telemetry.io/plugins/snap-plugin-collector-psutil/latest_build/linux/x86_64/snap-plugin-collector-psutil"
        file_url = "http://snap.ci.snap-telemetry.io/plugins/snap-plugin-publisher-file/latest_build/linux/x86_64/snap-plugin-publisher-file"

        # set and download required binaries (snapteld, snaptel, plugins)
        self.binaries = bins.Binaries()
        self.binaries.snapteld = bins.Snapteld(snapteld_url, snap_dir)
        self.binaries.snaptel = bins.Snaptel(snaptel_url, snap_dir)
        self.binaries.collector = bins.Plugin(psutil_url, plugins_dir, "collector", 9)
        self.binaries.publisher = bins.Plugin(file_url, plugins_dir, "publisher", -1)

        utils.download_binaries(self.binaries)

        self.task_file = "{}/examples/tasks/task-psutil.json".format(os.getenv("PROJECT_DIR", "/snap-plugin-collector-psutil"))

        log.info("starting snapteld")
        self.binaries.snapteld.start()
        if not self.binaries.snapteld.isAlive():
            self.fail("snapteld thread died")

        log.debug("Waiting for snapteld to finish starting")
        if not self.binaries.snapteld.wait():
            log.error("snapteld errors: {}".format(self.binaries.snapteld.errors))
            self.binaries.snapteld.kill()
            self.fail("snapteld not ready, timeout!")