From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 1E70B6B3D9
 for <pbs-devel@lists.proxmox.com>; Tue, 26 Jan 2021 11:49:41 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 10F181537F
 for <pbs-devel@lists.proxmox.com>; Tue, 26 Jan 2021 11:49:41 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 8ED0615377
 for <pbs-devel@lists.proxmox.com>; Tue, 26 Jan 2021 11:49:40 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5F8E741976
 for <pbs-devel@lists.proxmox.com>; Tue, 26 Jan 2021 11:49:40 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Tue, 26 Jan 2021 11:49:39 +0100
Message-Id: <20210126104939.30218-1-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.260 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pbs-devel] [PATCH proxmox-backup] tape/changer/mtx: add mtx parser
 test
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Tue, 26 Jan 2021 10:49:41 -0000

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/tape/changer/mtx/parse_mtx_status.rs | 37 ++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/src/tape/changer/mtx/parse_mtx_status.rs b/src/tape/changer/mtx/parse_mtx_status.rs
index cdfcba76..c042c318 100644
--- a/src/tape/changer/mtx/parse_mtx_status.rs
+++ b/src/tape/changer/mtx/parse_mtx_status.rs
@@ -172,3 +172,40 @@ pub fn parse_mtx_status(i: &str) -> Result<MtxStatus, Error> {
 
     Ok(status)
 }
+
+#[test]
+fn test_changer_status() -> Result<(), Error> {
+
+    let output = r###" Storage Changer /dev/tape/by-id/scsi-387408F60F0000:2 Drives, 24 Slots ( 4 Import/Export )
+Data Transfer Element 0:Empty
+Data Transfer Element 1:Empty
+      Storage Element 1:Full :VolumeTag=CLN002CU
+      Storage Element 2:Full :VolumeTag=test22L1
+      Storage Element 3:Full :VolumeTag=test23L1
+      Storage Element 4:Full :VolumeTag=CLN001CU
+      Storage Element 5:Full :VolumeTag=test1
+      Storage Element 6:Empty
+      Storage Element 7:Empty
+      Storage Element 8:Empty
+      Storage Element 9:Empty
+      Storage Element 10:Empty
+      Storage Element 11:Empty
+      Storage Element 12:Empty
+      Storage Element 13:Empty
+      Storage Element 14:Empty
+      Storage Element 15:Empty
+      Storage Element 16:Empty
+      Storage Element 17:Empty
+      Storage Element 18:Empty
+      Storage Element 19:Empty
+      Storage Element 20:Empty
+      Storage Element 21 IMPORT/EXPORT:Empty
+      Storage Element 22 IMPORT/EXPORT:Empty
+      Storage Element 23 IMPORT/EXPORT:Empty
+      Storage Element 24 IMPORT/EXPORT:Empty
+"###;
+
+    let _ = parse_mtx_status(&output)?;
+
+    Ok(())
+}
-- 
2.20.1