Skip to content

Commit

Permalink
support for testing cubefs
Browse files Browse the repository at this point in the history
  • Loading branch information
young-scott committed Oct 13, 2023
1 parent a43945f commit 9cb75ba
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions test_cubefs/stress/sql/case_3_5.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SET union_default_mode = 'DISTINCT';
WITH temperature AS (
SELECT dt,
device_name,
Expand Down Expand Up @@ -47,4 +46,5 @@ SELECT DISTINCT device_name,
'SUMMER'
FROM temperature
WHERE dt >= DATE '2019-06-01'
AND dt < DATE '2019-09-01';
AND dt < DATE '2019-09-01'
SETTINGS union_default_mode = 'DISTINCT';
4 changes: 2 additions & 2 deletions test_cubefs/stress/sql/case_3_6.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SET union_default_mode = 'DISTINCT';
SELECT yr,
mo,
SUM(coffee_hourly_avg) AS coffee_monthly_sum,
Expand Down Expand Up @@ -38,4 +37,5 @@ FROM (
GROUP BY yr,
mo
ORDER BY yr,
mo;
mo
SETTINGS union_default_mode = 'DISTINCT';
5 changes: 3 additions & 2 deletions test_cubefs/stress/sql/mgbench1.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE if not exists mgbench.logs1 (
CREATE TABLE if not exists mgbench.logs1 UUID '28f1c61c-2970-457a-bffe-454156ddcfea' (
log_time DateTime,
machine_name LowCardinality(String),
machine_group LowCardinality(String),
Expand All @@ -22,4 +22,5 @@ CREATE TABLE if not exists mgbench.logs1 (
bytes_out Nullable(Float32)
)
ENGINE = ReplicatedMergeTree('/tables/mgbench/logs1', '{replica}')
ORDER BY (machine_group, machine_name, log_time);
ORDER BY (machine_group, machine_name, log_time)
SETTINGS storage_policy='cubefs_only';
5 changes: 3 additions & 2 deletions test_cubefs/stress/sql/mgbench2.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CREATE TABLE if not exists mgbench.logs2 (
CREATE TABLE if not exists mgbench.logs2 UUID '28f1c61c-2970-457a-bffe-454156ddcfeb'(
log_time DateTime,
client_ip IPv4,
request String,
status_code UInt16,
object_size UInt64
)
ENGINE = ReplicatedMergeTree('/tables/mgbench/logs2', '{replica}')
ORDER BY log_time;
ORDER BY log_time
SETTINGS storage_policy='cubefs_only';
5 changes: 3 additions & 2 deletions test_cubefs/stress/sql/mgbench3.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE if not exists mgbench.logs3 (
CREATE TABLE if not exists mgbench.logs3 UUID '28f1c61c-2970-457a-bffe-454156ddcfec' (
log_time DateTime64,
device_id FixedString(15),
device_name LowCardinality(String),
Expand All @@ -9,4 +9,5 @@ CREATE TABLE if not exists mgbench.logs3 (
event_value Nullable(Float32)
)
ENGINE = ReplicatedMergeTree('/tables/mgbench/logs3', '{replica}')
ORDER BY (event_type, log_time);
ORDER BY (event_type, log_time)
SETTINGS storage_policy='cubefs_only';
2 changes: 1 addition & 1 deletion test_cubefs/test_cubefs_for_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,4 @@ def test_case5(self):

if __name__=="__main__":
pytest.main(['-v', '-n8' , '--dist=loadscope', 'test_cubefs_for_mutation.py'])
# pytest.main(['-s' , 'test_cubefs_for_mutation.py'])
#pytest.main(['-s' , 'test_cubefs_for_mutation.py'])
8 changes: 5 additions & 3 deletions test_cubefs/test_cubefs_for_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,14 @@ def run_task(self, file_name):
result = super().executeSQLFile(super().client1(), file_name)
end = time.time()
print(f"耗时{end - start}秒")
with open(expect_file_name, 'crw') as f:
f.write(result)
# with open(expect_file_name, 'crw') as f:
# f.write(result)
print(result)

def test_case1(self):
cases = []
for i in range(0, 1):
for i in range(0, 1000000000):
# for i in range(0, 1):
cases.append("./stress/sql/case_1_1.sql")
cases.append("./stress/sql/case_1_2.sql")
cases.append("./stress/sql/case_1_3.sql")
Expand Down

0 comments on commit 9cb75ba

Please sign in to comment.