cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10210) remove test file
Date Thu, 04 Jan 2018 11:47:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16311240#comment-16311240
] 

ASF GitHub Bot commented on CLOUDSTACK-10210:
---------------------------------------------

rhtyd closed pull request #2384: CLOUDSTACK-10210 cleanup testfile
URL: https://github.com/apache/cloudstack/pull/2384
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java
b/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java
index e437a0f3b64..44d762ff02d 100644
--- a/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java
+++ b/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java
@@ -32,6 +32,7 @@
 import org.powermock.modules.junit4.PowerMockRunner;
 
 import java.io.BufferedWriter;
+import java.io.File;
 import java.io.FileWriter;
 import java.io.StringWriter;
 
@@ -52,15 +53,21 @@ public void setUp() {
     @Test
     @PrepareForTest(NfsSecondaryStorageResource.class)
     public void testSwiftWriteMetadataFile() throws Exception {
-        String expected = "uniquename=test\nfilename=testfile\nsize=100\nvirtualsize=1000";
+        String filename = "testfile";
+        try {
+            String expected = "uniquename=test\nfilename=" + filename + "\nsize=100\nvirtualsize=1000";
 
-        StringWriter stringWriter = new StringWriter();
-        BufferedWriter bufferWriter = new BufferedWriter(stringWriter);
-        PowerMockito.whenNew(BufferedWriter.class).withArguments(any(FileWriter.class)).thenReturn(bufferWriter);
+            StringWriter stringWriter = new StringWriter();
+            BufferedWriter bufferWriter = new BufferedWriter(stringWriter);
+            PowerMockito.whenNew(BufferedWriter.class).withArguments(any(FileWriter.class)).thenReturn(bufferWriter);
 
-        resource.swiftWriteMetadataFile("testfile", "test", "testfile", 100, 1000);
+            resource.swiftWriteMetadataFile(filename, "test", filename, 100, 1000);
 
-        Assert.assertEquals(expected, stringWriter.toString());
+            Assert.assertEquals(expected, stringWriter.toString());
+        } finally {
+            File remnance = new File(filename);
+            remnance.delete();
+        }
     }
 
     @Test


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> remove test file
> ----------------
>
>                 Key: CLOUDSTACK-10210
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10210
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Secondary Storage
>            Reporter: Daan Hoogland
>            Assignee: Daan Hoogland
>            Priority: Trivial
>
> test leaves 'testfile' as remanence. remove in @after test finishes 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message