예제 #1
0
 def test_regular(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.ammofile = "data/dummy.ammo"
     stepper.rps_schedule = ["const(1,10)"]
     stepper.generate_stpd()
     res = open(stepper.stpd_file, "r").read()
     self.assertNotEquals("", res)
     self.assertEquals(269, os.path.getsize(stepper.stpd_file))
예제 #2
0
 def test_free_inst(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.ammofile = "data/dummy.ammo"
     stepper.loop_limit = 2
     stepper.generate_stpd()
     res = open(stepper.stpd_file, "r").read()
     self.assertNotEquals("", res)
     self.assertEquals(56, os.path.getsize(stepper.stpd_file))
예제 #3
0
    def prepare_stepper(self):
        '''
        Generate test data if necessary
        '''
        self.stpd = self.__get_stpd_filename()
        self.owner.core.set_option(self.owner.SECTION, self.OPTION_STPD,
                                   self.stpd)
        if self.use_caching and not self.force_stepping and os.path.exists(
                self.stpd) and os.path.exists(self.stpd + ".conf"):
            self.log.info("Using cached stpd-file: %s", self.stpd)
            stepper = Stepper(self.stpd)  # just to store cached data
            self.__read_cached_options(self.stpd + ".conf", stepper)
        else:
            stepper = self.__make_stpd_file(self.stpd)

        self.steps = stepper.steps

        # self.core.set_option(AggregatorPlugin.SECTION, AggregatorPlugin.OPTION_CASES, stepper.cases)
        self.owner.core.set_option(self.owner.SECTION, self.OPTION_STEPS,
                                   ' '.join([str(x) for x in stepper.steps]))
        self.owner.core.set_option(self.owner.SECTION, self.OPTION_LOADSCHEME,
                                   stepper.loadscheme)
        self.owner.core.set_option(self.owner.SECTION, self.OPTION_LOOP_COUNT,
                                   str(stepper.loop_count))
        self.owner.core.set_option(self.owner.SECTION, self.OPTION_AMMO_COUNT,
                                   str(stepper.ammo_count))
        self.__calculate_test_duration(stepper.steps)

        self.owner.core.config.flush(self.stpd + ".conf")
예제 #4
0
 def test_uri(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.rps_schedule = ["const(1,10)"]
     stepper.uris = ["/", "/test"]
     stepper.header_http = "1.1"
     stepper.headers = ["[Host: ya.ru]", "[Connection: close]"]
     stepper.generate_stpd()
     res = open(stepper.stpd_file, 'r').read()
     self.assertNotEquals("", res)
     self.assertEquals(619, os.path.getsize(stepper.stpd_file))
예제 #5
0
 def test_free_inst_sched(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.ammofile = "data/dummy.ammo"
     stepper.instances_schedule = "line(1,5,15)"
     stepper.loop_limit = 15
     stepper.generate_stpd()
     res = open(stepper.stpd_file, 'r').read()
     self.assertNotEquals("", res)
     self.assertEquals(406, os.path.getsize(stepper.stpd_file))
예제 #6
0
 def test_uri(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.rps_schedule = ["const(1,10)"]
     stepper.uris = ["/", "/test"]
     stepper.header_http = "1.1"
     stepper.headers = ["[Host: ya.ru]", "[Connection: close]"]
     stepper.generate_stpd()
     res = open(stepper.stpd_file, "r").read()
     self.assertNotEquals("", res)
     self.assertEquals(619, os.path.getsize(stepper.stpd_file))
예제 #7
0
 def test_regular(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.ammofile = "data/dummy.ammo"
     stepper.rps_schedule = ["const(1,10)"]
     stepper.generate_stpd()
     res = open(stepper.stpd_file, 'r').read()
     self.assertNotEquals("", res)
     self.assertEquals(269, os.path.getsize(stepper.stpd_file))
예제 #8
0
 def test_free_inst(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.ammofile = "data/dummy.ammo"
     stepper.loop_limit = 2
     stepper.generate_stpd()
     res = open(stepper.stpd_file, 'r').read()
     self.assertNotEquals("", res)
     self.assertEquals(56, os.path.getsize(stepper.stpd_file))
예제 #9
0
 def test_free_inst_sched(self):
     stepper = Stepper(tempfile.mkstemp()[1])
     stepper.ammofile = "data/dummy.ammo"
     stepper.instances_schedule = "line(1,5,15)"
     stepper.loop_limit = 15
     stepper.generate_stpd()
     res = open(stepper.stpd_file, "r").read()
     self.assertNotEquals("", res)
     self.assertEquals(406, os.path.getsize(stepper.stpd_file))
예제 #10
0
    def __make_stpd_file(self, stpd):
        '''
        stpd generation using Stepper class
        '''
        self.log.info("Making stpd-file: %s", self.stpd)
        stepper = Stepper(stpd)
        stepper.autocases = int(self.autocases)
        stepper.rps_schedule = self.rps_schedule
        stepper.instances_schedule = self.instances_schedule
        stepper.loop_limit = self.loop_limit
        stepper.uris = self.uris
        stepper.headers = self.headers
        stepper.header_http = self.http_ver
        stepper.ammofile = self.ammo_file

        stepper.generate_stpd()
        return stepper
예제 #11
0
    def __make_stpd_file(self, stpd):
        '''
        stpd generation using Stepper class
        '''
        self.log.info("Making stpd-file: %s", self.stpd)
        stepper = Stepper(stpd)
        stepper.autocases = int(self.autocases)
        stepper.rps_schedule = self.rps_schedule
        stepper.instances_schedule = self.instances_schedule
        stepper.loop_limit = self.loop_limit
        stepper.uris = self.uris
        stepper.headers = self.headers
        stepper.header_http = self.http_ver
        stepper.ammofile = self.ammo_file

        stepper.generate_stpd()
        return stepper