use send-mail service to mail test report, data line must be at the top, or mail failed.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- .../maintain/walk-os-test/walk-os-iperf-test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/user-client/maintain/walk-os-test/walk-os-iperf-test b/user-client/maintain/walk-os-test/walk-os-iperf-test index ccbff68..91a3541 100755 --- a/user-client/maintain/walk-os-test/walk-os-iperf-test +++ b/user-client/maintain/walk-os-test/walk-os-iperf-test @@ -45,6 +45,20 @@ TESTBOX = %w[vm-2p8g vm-pxe-2p8g].freeze TEST_REPORT = 'walk-test.report' TEST_YAML = 'iperf-walk-os.yaml'
+def mail_report(data) + %x(curl -X POST 'localhost:11312/send_mail_yaml' -d "#{data}") +end + +def get_mail_data + mail_body = File.read(TEST_REPORT).chomp + data = " +subject: os rootfs test report +to: user@emailaddress +body: '#{mail_body}'" + + mail_report(data) +end + def logging(*log_params) log_format = '%-18s %-37s %-23s %-23s %-12s %-13s %-50s' File.open(TEST_REPORT, 'a') do |f| @@ -114,3 +128,5 @@ end logging('Job_ID', 'OS', 'Begin', 'End', 'Cost/sec', 'Job_State', 'Result_Url')
MOUNT_TYPE.each { |os_mount| get_testbox(os_mount) } + +get_mail_data