You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Wei ZHOU <us...@gmail.com> on 2013/06/03 08:19:41 UTC

Is it nessesary to test getBase64Keystore 100000 times in ConfigurationServerImplTest.java

The build of latest master branch spent much more time on
ConfigurationServerImplTest.java, which includes test getBase64Keystore
100000 times.

Is it neccesary?

[root@weizhou-centos incubator-cloudstack]# git diff
2f29185943ac0412aa501b59493837b4055642e0
4894187991d581b72807b4282b7a29a48a8031e5
+    @Test
+    public void testGetBase64KeystoreZillionTimes() throws IOException {
+        File temp = File.createTempFile("keystore", "");
+        try {
+            // may cause IOException with the original implementation
because of too many open files
+            for (int i = 0; i < 100000; i++) {
+                FileUtils.writeStringToFile(temp,
Base64.encodeBase64String(TEST.getBytes()));
+                final String keystore =
ConfigurationServerImpl.getBase64Keystore(temp.getPath());
+                // let's decode it to make sure it makes sense
+                Base64.decodeBase64(keystore);
+            }
+        } finally {
+            temp.delete();
+        }
+    }

Re: Is it nessesary to test getBase64Keystore 100000 times in ConfigurationServerImplTest.java

Posted by Wei ZHOU <us...@gmail.com>.
Prasanna,

Thanks

-Wei

2013/6/4 Prasanna Santhanam <ts...@apache.org>

> On Tue, Jun 04, 2013 at 01:23:10PM +0200, Laszlo Hornyak wrote:
> > Hi,
> >
> > Not anymore, but that was where the code broke because of a resource
> leak.
> > Please just remove that test!
> >
>
> Yup - removed y'day with 22bda5c3c960e1e6897b3b0aaacdf91add97976d
>
> >
> > On Mon, Jun 3, 2013 at 8:19 AM, Wei ZHOU <us...@gmail.com> wrote:
> >
> > > The build of latest master branch spent much more time on
> > > ConfigurationServerImplTest.java, which includes test getBase64Keystore
> > > 100000 times.
> > >
> > > Is it neccesary?
> > >
> > > [root@weizhou-centos incubator-cloudstack]# git diff
> > > 2f29185943ac0412aa501b59493837b4055642e0
> > > 4894187991d581b72807b4282b7a29a48a8031e5
> > > +    @Test
> > > +    public void testGetBase64KeystoreZillionTimes() throws
> IOException {
> > > +        File temp = File.createTempFile("keystore", "");
> > > +        try {
> > > +            // may cause IOException with the original implementation
> > > because of too many open files
> > > +            for (int i = 0; i < 100000; i++) {
> > > +                FileUtils.writeStringToFile(temp,
> > > Base64.encodeBase64String(TEST.getBytes()));
> > > +                final String keystore =
> > > ConfigurationServerImpl.getBase64Keystore(temp.getPath());
> > > +                // let's decode it to make sure it makes sense
> > > +                Base64.decodeBase64(keystore);
> > > +            }
> > > +        } finally {
> > > +            temp.delete();
> > > +        }
> > > +    }
> > >
> >
> >
> >
> > --
> >
> > EOF
>
> --
> Prasanna.,
>
> ------------------------
> Powered by BigRock.com
>
>

Re: Is it nessesary to test getBase64Keystore 100000 times in ConfigurationServerImplTest.java

Posted by Laszlo Hornyak <la...@gmail.com>.
Thanks and sorry for the inconvenience!


On Tue, Jun 4, 2013 at 1:32 PM, Prasanna Santhanam <ts...@apache.org> wrote:

> On Tue, Jun 04, 2013 at 01:23:10PM +0200, Laszlo Hornyak wrote:
> > Hi,
> >
> > Not anymore, but that was where the code broke because of a resource
> leak.
> > Please just remove that test!
> >
>
> Yup - removed y'day with 22bda5c3c960e1e6897b3b0aaacdf91add97976d
>
> >
> > On Mon, Jun 3, 2013 at 8:19 AM, Wei ZHOU <us...@gmail.com> wrote:
> >
> > > The build of latest master branch spent much more time on
> > > ConfigurationServerImplTest.java, which includes test getBase64Keystore
> > > 100000 times.
> > >
> > > Is it neccesary?
> > >
> > > [root@weizhou-centos incubator-cloudstack]# git diff
> > > 2f29185943ac0412aa501b59493837b4055642e0
> > > 4894187991d581b72807b4282b7a29a48a8031e5
> > > +    @Test
> > > +    public void testGetBase64KeystoreZillionTimes() throws
> IOException {
> > > +        File temp = File.createTempFile("keystore", "");
> > > +        try {
> > > +            // may cause IOException with the original implementation
> > > because of too many open files
> > > +            for (int i = 0; i < 100000; i++) {
> > > +                FileUtils.writeStringToFile(temp,
> > > Base64.encodeBase64String(TEST.getBytes()));
> > > +                final String keystore =
> > > ConfigurationServerImpl.getBase64Keystore(temp.getPath());
> > > +                // let's decode it to make sure it makes sense
> > > +                Base64.decodeBase64(keystore);
> > > +            }
> > > +        } finally {
> > > +            temp.delete();
> > > +        }
> > > +    }
> > >
> >
> >
> >
> > --
> >
> > EOF
>
> --
> Prasanna.,
>
> ------------------------
> Powered by BigRock.com
>
>


-- 

EOF

Re: Is it nessesary to test getBase64Keystore 100000 times in ConfigurationServerImplTest.java

Posted by Prasanna Santhanam <ts...@apache.org>.
On Tue, Jun 04, 2013 at 01:23:10PM +0200, Laszlo Hornyak wrote:
> Hi,
> 
> Not anymore, but that was where the code broke because of a resource leak.
> Please just remove that test!
> 

Yup - removed y'day with 22bda5c3c960e1e6897b3b0aaacdf91add97976d

> 
> On Mon, Jun 3, 2013 at 8:19 AM, Wei ZHOU <us...@gmail.com> wrote:
> 
> > The build of latest master branch spent much more time on
> > ConfigurationServerImplTest.java, which includes test getBase64Keystore
> > 100000 times.
> >
> > Is it neccesary?
> >
> > [root@weizhou-centos incubator-cloudstack]# git diff
> > 2f29185943ac0412aa501b59493837b4055642e0
> > 4894187991d581b72807b4282b7a29a48a8031e5
> > +    @Test
> > +    public void testGetBase64KeystoreZillionTimes() throws IOException {
> > +        File temp = File.createTempFile("keystore", "");
> > +        try {
> > +            // may cause IOException with the original implementation
> > because of too many open files
> > +            for (int i = 0; i < 100000; i++) {
> > +                FileUtils.writeStringToFile(temp,
> > Base64.encodeBase64String(TEST.getBytes()));
> > +                final String keystore =
> > ConfigurationServerImpl.getBase64Keystore(temp.getPath());
> > +                // let's decode it to make sure it makes sense
> > +                Base64.decodeBase64(keystore);
> > +            }
> > +        } finally {
> > +            temp.delete();
> > +        }
> > +    }
> >
> 
> 
> 
> -- 
> 
> EOF

-- 
Prasanna.,

------------------------
Powered by BigRock.com


Re: Is it nessesary to test getBase64Keystore 100000 times in ConfigurationServerImplTest.java

Posted by Laszlo Hornyak <la...@gmail.com>.
Hi,

Not anymore, but that was where the code broke because of a resource leak.
Please just remove that test!


On Mon, Jun 3, 2013 at 8:19 AM, Wei ZHOU <us...@gmail.com> wrote:

> The build of latest master branch spent much more time on
> ConfigurationServerImplTest.java, which includes test getBase64Keystore
> 100000 times.
>
> Is it neccesary?
>
> [root@weizhou-centos incubator-cloudstack]# git diff
> 2f29185943ac0412aa501b59493837b4055642e0
> 4894187991d581b72807b4282b7a29a48a8031e5
> +    @Test
> +    public void testGetBase64KeystoreZillionTimes() throws IOException {
> +        File temp = File.createTempFile("keystore", "");
> +        try {
> +            // may cause IOException with the original implementation
> because of too many open files
> +            for (int i = 0; i < 100000; i++) {
> +                FileUtils.writeStringToFile(temp,
> Base64.encodeBase64String(TEST.getBytes()));
> +                final String keystore =
> ConfigurationServerImpl.getBase64Keystore(temp.getPath());
> +                // let's decode it to make sure it makes sense
> +                Base64.decodeBase64(keystore);
> +            }
> +        } finally {
> +            temp.delete();
> +        }
> +    }
>



-- 

EOF

Re: Is it nessesary to test getBase64Keystore 100000 times in ConfigurationServerImplTest.java

Posted by Prasanna Santhanam <ts...@apache.org>.
On Mon, Jun 03, 2013 at 08:19:41AM +0200, Wei ZHOU wrote:
> The build of latest master branch spent much more time on
> ConfigurationServerImplTest.java, which includes test getBase64Keystore
> 100000 times.
> 
> Is it neccesary?
> 
> [root@weizhou-centos incubator-cloudstack]# git diff
> 2f29185943ac0412aa501b59493837b4055642e0
> 4894187991d581b72807b4282b7a29a48a8031e5
> +    @Test
> +    public void testGetBase64KeystoreZillionTimes() throws IOException {
> +        File temp = File.createTempFile("keystore", "");
> +        try {
> +            // may cause IOException with the original implementation
> because of too many open files
> +            for (int i = 0; i < 100000; i++) {
> +                FileUtils.writeStringToFile(temp,
> Base64.encodeBase64String(TEST.getBytes()));
> +                final String keystore =
> ConfigurationServerImpl.getBase64Keystore(temp.getPath());
> +                // let's decode it to make sure it makes sense
> +                Base64.decodeBase64(keystore);
> +            }
> +        } finally {
> +            temp.delete();
> +        }
> +    }

My bad - feel free to fix the test. I see it's taking up a minute on
the build server too -

http://jenkins.buildacloud.org/view/master/job/cloudstack-master/org.apache.cloudstack$cloud-server/488/testReport/com.cloud.server/ConfigurationServerImplTest/


-- 
Prasanna.,

------------------------
Powered by BigRock.com