functional tests: only send sector-aligned IO

... to satisfy OCF assumptions.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2019-06-06 16:03:03 -04:00
parent 31ab2b3fe6
commit 4a548d26cf
2 changed files with 14 additions and 8 deletions

View File

@@ -107,7 +107,13 @@ class Data:
@classmethod
def from_string(cls, source: str, encoding: str = "ascii"):
return cls.from_bytes(bytes(source, encoding))
b = bytes(source, encoding)
# duplicate string to fill space up to sector boundary
padding_len = S.from_B(len(b), sector_aligned = True).B - len(b)
padding = b * (padding_len // len(b) + 1)
padding = padding[:padding_len]
b = b + padding
return cls.from_bytes(b)
@staticmethod
@DataOps.ALLOC